fix bug where no localstorage exists

This commit is contained in:
2017-02-22 17:22:36 -07:00
parent b1ae02faee
commit 0125643a41

View File

@@ -18,7 +18,9 @@ const store = new Vuex.Store({
plugins: [
createPersistedState({
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);
},
setState(key, state) {