-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (27 loc) · 884 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
import React from 'react';
import {render} from 'react-dom';
import {createStore, applyMiddleware} from 'redux';
import thunk from 'redux-thunk';
import {composeWithDevTools} from 'redux-devtools-extension';
import 'semantic-ui/dist/semantic.min.css';
import rootReducer from './rootReducer';
import {Provider} from 'react-redux';
import './style.css';
import Routs from './components/Routs';
import setAuthorizationToken from './utils/setAuthorizationToken';
import {setCurrentUser} from './actions/authActions';
import jwtDecode from 'jwt-decode';
const store = createStore(
rootReducer,
composeWithDevTools(applyMiddleware(thunk))
);
if (localStorage.jwtToken) {
setAuthorizationToken(localStorage.jwtToken);
store.dispatch(setCurrentUser(jwtDecode(localStorage.jwtToken)));
};
render(
<Provider store={store}>
<Routs />
</Provider>,
document.getElementById('root')
);