mirror of https://github.com/micromata/borgbackup-butler.git

Kai Reinhard
19.33.2018 1b27eb532dbc405cda3a4420345c78bb0bc7c6e7
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
37
38
39
40
41
42
43
44
45
46
47
import '../node_modules/bootstrap/dist/css/bootstrap.css';
import React from 'react';
import ReactDOM from 'react-dom';
import {applyMiddleware, createStore} from 'redux';
import thunk from 'redux-thunk';
import {Provider} from 'react-redux';
 
import WebApp from './containers/WebApp';
 
import reducers from './reducers';
 
import './css/my-style.css';
import {loadDictionary} from './utilities/i18n';
 
 
let storedState = window.localStorage.getItem('state');
 
if (storedState) {
    storedState = JSON.parse(storedState);
 
    if (storedState.version) {
        storedState.version.loading = false;
    }
 
    if (storedState.log) {
        storedState.log.loading = false;
    }
}
 
const store = createStore(
    reducers,
    storedState || undefined,
    applyMiddleware(thunk)
);
 
loadDictionary(store.getState().version.version, store.getState().version.language);
 
store.subscribe(() => {
    window.localStorage.setItem('state', JSON.stringify(store.getState()));
});
 
ReactDOM.render(
    <Provider store={store}>
        <WebApp/>
    </Provider>,
    document.getElementById('root')
);