We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5462bad commit 0b7c4e7Copy full SHA for 0b7c4e7
app_modules/site/preferences/strategies.js
@@ -33,12 +33,18 @@ export const LocalStorageStrategy = stampit().methods({
33
load () {
34
if (!window.localStorage) { return {}; }
35
const prefs = localStorage.getItem('prefs');
36
- return prefs && JSON.parse(prefs);
+ try {
37
+ return JSON.parse(prefs);
38
+ } catch (e) {
39
+ return {};
40
+ }
41
},
42
43
update (prefs) {
44
if (!window.localStorage) { return; }
- localStorage.setItem('prefs', JSON.stringify(prefs));
45
46
+ localStorage.setItem('prefs', JSON.stringify(prefs));
47
+ } catch (e) {}
48
}
49
});
50
0 commit comments