On changes to the react bundle webpack will store the current redux state in localStorage, waits (to allow the server to restart) then refreshes the page. On page load, it checks if it has state stored and loads it into the app.
17 lines
314 B
JavaScript
17 lines
314 B
JavaScript
import store from 'store';
|
|
|
|
const key = '__cold-storage__';
|
|
export function isColdStored() {
|
|
return store.has(key);
|
|
}
|
|
|
|
export function getColdStorage() {
|
|
const coldReloadData = store.get(key);
|
|
store.remove(key);
|
|
return coldReloadData;
|
|
}
|
|
|
|
export function saveToColdStorage(data) {
|
|
store.set(key, data);
|
|
}
|