2016-03-20 04:00:40 +00:00
|
|
|
import * as types from '../constants/actionTypes';
|
|
|
|
import {LOCALSTORAGE_KEY} from "../constants/global";
|
|
|
|
|
|
|
|
export function restoreState () {
|
|
|
|
return (dispatch) => {
|
|
|
|
setTimeout(() => {
|
|
|
|
let state = undefined;
|
|
|
|
try {
|
|
|
|
state = JSON.parse(localStorage[LOCALSTORAGE_KEY]);
|
|
|
|
} catch (e) { }
|
|
|
|
|
|
|
|
dispatch({type: types.GLOBAL_STATE_RESTORED, state});
|
2016-03-20 20:42:27 +00:00
|
|
|
}, 0);
|
2016-03-20 04:00:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function loadStart () {
|
|
|
|
return {type: types.GLOBAL_LOAD_START};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function loadStop () {
|
|
|
|
return {type: types.GLOBAL_LOAD_STOP};
|
|
|
|
}
|