fix bug where no localstorage exists
This commit is contained in:
@@ -18,7 +18,9 @@ const store = new Vuex.Store({
|
|||||||
plugins: [
|
plugins: [
|
||||||
createPersistedState({
|
createPersistedState({
|
||||||
getState(key) {
|
getState(key) {
|
||||||
const state = lz.decompress(window.localStorage.getItem(key));
|
const storedState = window.localStorage.getItem(key);
|
||||||
|
if (!storedState) return {};
|
||||||
|
const state = lz.decompress(storedState);
|
||||||
return JSON.parse(state);
|
return JSON.parse(state);
|
||||||
},
|
},
|
||||||
setState(key, state) {
|
setState(key, state) {
|
||||||
|
|||||||
Reference in New Issue
Block a user