chrone: sperate client and server to different repos.

This commit is contained in:
a.bouhuolia
2021-09-21 17:13:53 +02:00
parent e011b2a82b
commit 18df5530c7
10015 changed files with 17686 additions and 97524 deletions

23
src/store/localStorage.js Normal file
View File

@@ -0,0 +1,23 @@
const LOCAL_STORAGE_NAMESPACE = 'application_state';
export const loadState = () => {
try {
const serializedState = localStorage.getItem(LOCAL_STORAGE_NAMESPACE);
if (serializedState === null) {
return undefined;
}
return JSON.parse(serializedState);
} catch(error) {
return undefined;
}
};
export const saveState = (state) => {
try {
const serializedState = JSON.stringify(state);
localStorage.setItem(LOCAL_STORAGE_NAMESPACE, serializedState);
} catch (error) {
throw new Error('Something want wrong');
}
}