From 3b14c02860e972a24ede5111138a93afa4e36f47 Mon Sep 17 00:00:00 2001 From: Barry Low Date: Wed, 10 Oct 2018 23:00:03 -0700 Subject: [PATCH] update local-storage --- client/.babelrc | 2 +- client/src/utils/local-storage.js | 26 -------------------------- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/client/.babelrc b/client/.babelrc index e60d3036a..efe06ecc1 100644 --- a/client/.babelrc +++ b/client/.babelrc @@ -1,4 +1,4 @@ { "presets": ["@babel/preset-env", "@babel/preset-react"], - "plugins": ["@babel/plugin-proposal-class-properties"] + "plugins": ["@babel/plugin-proposal-class-properties", "@babel/plugin-syntax-dynamic-import", "dynamic-import-node"] } diff --git a/client/src/utils/local-storage.js b/client/src/utils/local-storage.js index 98220f61d..963ba0f36 100644 --- a/client/src/utils/local-storage.js +++ b/client/src/utils/local-storage.js @@ -1,34 +1,8 @@ -const getStateFromStorage = version => { - const localState = JSON.parse(window.localStorage.getItem('aa-team')) - - try { - if (localState !== undefined && localState !== null) { - if ( - localState.appVersion !== undefined && - localState.appVersion !== null - ) { - if (localState.appVersion === version) { - return localState - } - } - } else { - throw new Error() - } - } catch (error) { - return false - } -} - -const storeStateInStorage = state => - window.localStorage.setItem('aa-team', JSON.stringify(state)) - const getItem = async name => window.localStorage.getItem(name) const setItem = async (name, value) => window.localStorage.setItem(name, value) const removeItem = async name => window.localStorage.removeItem(name) export { - getStateFromStorage, - storeStateInStorage, getItem, setItem, removeItem