1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-05 23:10:41 +03:00

fix local storage idiocy

This commit is contained in:
Matthew Hodgson
2017-01-21 22:27:55 +01:00
parent 532f4e59c9
commit 39c122fe4f
2 changed files with 6 additions and 3 deletions

View File

@@ -150,7 +150,8 @@ module.exports = {
},
getLocalSettings: function() {
return localStorage.getItem('mx_local_settings');
var localSettingsString = localStorage.getItem('mx_local_settings') || '{}';
return JSON.parse(localSettingsString);
},
getLocalSetting: function(type, defaultValue = null) {
@@ -162,7 +163,7 @@ module.exports = {
var settings = this.getLocalSettings();
settings[type] = value;
// FIXME: handle errors
localStorage.setItem('mx_local_settings', settings);
localStorage.setItem('mx_local_settings', JSON.stringify(settings));
},
isFeatureEnabled: function(feature: string): boolean {