-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (28 loc) · 956 Bytes
/
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
import React from 'react'
import ReactDOM from 'react-dom'
import { createStore, applyMiddleware } from 'redux'
import reduxPromise from 'redux-promise-middleware'
import reduxLogger from 'redux-logger'
import reduxThunk from 'redux-thunk'
import { Provider } from 'react-redux'
import App from './app/components/app'
import reducers from './app/reducers'
import authMiddleware from './app/middlewares/auth'
// ========== Initialize application ==========
const createReduxStore = () => {
const middlewares = applyMiddleware(
reduxThunk,
authMiddleware,
reduxLogger,
reduxPromise())
const store = createStore(reducers, {}, middlewares)
return store
}
const start = async () => {
const store = createReduxStore()
const mainContainerElement = document.getElementById('main-container')
ReactDOM.render(<Provider store={store}><App /></Provider>, mainContainerElement)
}
start().catch(err => {
console.error(err.message)
})