hotfix: clear cached joruneys if localstorage is full
This commit is contained in:
parent
f994059eae
commit
90a4e70fe0
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue