hotfix: clear cached joruneys if localstorage is full

This commit is contained in:
Leah 2020-02-11 15:07:12 +01:00
parent f994059eae
commit 90a4e70fe0

View file

@ -145,10 +145,18 @@ export const clearDataStorage = () => {
};
export const saveDataStorage = () => {
let name = 'dataStorage_dev';
if (devMode !== true) {
localStorage.setItem('dataStorage', JSON.stringify(dataStorage));
} else {
localStorage.setItem('dataStorage_dev', JSON.stringify(dataStorage));
name = 'dataStorage';
}
try {
localStorage.setItem(name, JSON.stringify(dataStorage));
} catch (e) {
ConsoleLog("yikes, localstorage full, clear it...")
dataStorage.journeys = {};
saveDataStorage();
}
};