mirror of
https://github.com/Radarr/Radarr
synced 2025-02-25 15:43:08 +00:00
Update localstorage key prefixes
This commit is contained in:
parent
266f28883a
commit
f38430d632
1 changed files with 10 additions and 10 deletions
|
@ -2,7 +2,7 @@ var $ = require('jquery');
|
|||
var vent = require('./vent');
|
||||
|
||||
module.exports = {
|
||||
ConfigNamespace : 'Radarr',
|
||||
ConfigNamespace : 'Radarr.',
|
||||
|
||||
Events : {
|
||||
ConfigUpdatedEvent : 'ConfigUpdatedEvent'
|
||||
|
@ -18,10 +18,10 @@ module.exports = {
|
|||
},
|
||||
|
||||
getValueJson : function (key, defaultValue) {
|
||||
key = this.ConfigNamespace + key;
|
||||
var storeKey = this.ConfigNamespace + key;
|
||||
defaultValue = defaultValue || {};
|
||||
|
||||
var storeValue = window.localStorage.getItem(key);
|
||||
var storeValue = window.localStorage.getItem(storeKey);
|
||||
|
||||
if (!storeValue) {
|
||||
return defaultValue;
|
||||
|
@ -37,8 +37,8 @@ module.exports = {
|
|||
},
|
||||
|
||||
getValue : function(key, defaultValue) {
|
||||
key = this.ConfigNamespace + key;
|
||||
var storeValue = window.localStorage.getItem(key);
|
||||
var storeKey = this.ConfigNamespace + key;
|
||||
var storeValue = window.localStorage.getItem(storeKey);
|
||||
|
||||
if (!storeValue) {
|
||||
return defaultValue;
|
||||
|
@ -52,22 +52,22 @@ module.exports = {
|
|||
},
|
||||
|
||||
setValue : function(key, value) {
|
||||
key = this.ConfigNamespace + key;
|
||||
console.log('Config: [{0}] => [{1}]'.format(key, value));
|
||||
var storeKey = this.ConfigNamespace + key;
|
||||
console.log('Config: [{0}] => [{1}]'.format(storeKey, value));
|
||||
|
||||
if (this.getValue(key) === value.toString()) {
|
||||
if (this.getValue(storeKey) === value.toString()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
window.localStorage.setItem(key, value);
|
||||
window.localStorage.setItem(storeKey, value);
|
||||
vent.trigger(this.Events.ConfigUpdatedEvent, {
|
||||
key : key,
|
||||
value : value
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
console.error('Unable to save config: [{0}] => [{1}]'.format(key, value));
|
||||
console.error('Unable to save config: [{0}] => [{1}]'.format(storeKey, value));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue