-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (33 loc) · 1.06 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React from 'react';
import ReactDOM from 'react-dom';
import { createStore } from 'redux';
import ResultsContainer from './components/ResultsContainer';
import { mainReducer as reducers} from './reducers/index.js';
import registerServiceWorker from './registerServiceWorker';
import * as initialState from './initialState';
fetch('/results?pg=1&lim=20&ord=-1&srt=date')
.then(function(res) {
return (res.json());
})
.then(function (data) {
const store = createStore(reducers, {
lim: initialState.lim,
page: initialState.page,
sort: initialState.sort,
apartments: initialState.apartments,
houses: initialState.houses,
occupancy: initialState.occupancy,
maxPrice: initialState.maxPrice,
minPrice: initialState.minPrice,
ord: initialState.ord,
term: initialState.term,
furnished: initialState.furnished,
results: data,
});
const resultsContainer = <ResultsContainer store={store}/>
ReactDOM.render(
resultsContainer,
document.getElementById('root')
);
registerServiceWorker();
});