This commit is contained in:
Daniel Ternyak 2017-07-05 17:16:32 -05:00
parent cbf2fd39d0
commit 90d7b52987
2 changed files with 3 additions and 4 deletions

View File

@ -1,4 +1,3 @@
//flow
import React from 'react';
import { render } from 'react-dom';
import { syncHistoryWithStore, routerMiddleware } from 'react-router-redux';

View File

@ -1,3 +1,4 @@
// @flow
export const REDUX_STATE = 'REDUX_STATE';
export const loadState = () => {
@ -12,7 +13,7 @@ export const loadState = () => {
}
};
export const saveState = state => {
export const saveState = (state: Object) => {
try {
const serializedState = JSON.stringify(state);
localStorage.setItem(REDUX_STATE, serializedState);
@ -26,8 +27,7 @@ export const loadStatePropertyOrEmptyObject = (key: string): Object => {
if (localStorageState) {
if (localStorageState.hasOwnProperty(key)) {
return localStorageState[key];
} else {
return {};
}
}
return {};
};