add a potential initialState to the store (for testing)
This commit is contained in:
parent
24b07c3557
commit
012db36e65
@ -11,14 +11,11 @@ if (dev && browser && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) {
|
||||
composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
|
||||
}
|
||||
|
||||
export default () => {
|
||||
export default (initialState = undefined) => {
|
||||
if (browser) {
|
||||
const i = localStorage.getItem("ship");
|
||||
|
||||
let initialState = undefined;
|
||||
|
||||
if( browser ) {
|
||||
const i =localStorage.getItem('ship');
|
||||
|
||||
if(i) initialState = JSON.parse(localStorage.getItem('ship'));
|
||||
if (i) initialState = JSON.parse(localStorage.getItem("ship"));
|
||||
}
|
||||
|
||||
const duxStore = shipDux.createStore(initialState, (mw) =>
|
||||
@ -31,7 +28,7 @@ export default () => {
|
||||
if (previous === duxStore.getState()) return;
|
||||
previous = duxStore.getState();
|
||||
set(previous);
|
||||
if( browser ) localStorage.setItem('ship', JSON.stringify(previous));
|
||||
if (browser) localStorage.setItem("ship", JSON.stringify(previous));
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user