aboutsummaryrefslogtreecommitdiff
path: root/src/settings/actions/setting.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-10-09 15:30:05 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-10-09 15:30:05 +0900
commitc913dcdec775094daa9a64fa40034b3122320660 (patch)
tree978f2ad2581bc069e9369b28fe743b91c09f18a3 /src/settings/actions/setting.js
parent355c0c64575adad4886647a1df3da173598b558b (diff)
parse json in settings
Diffstat (limited to 'src/settings/actions/setting.js')
-rw-r--r--src/settings/actions/setting.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/settings/actions/setting.js b/src/settings/actions/setting.js
index 697bcf0..3525f0a 100644
--- a/src/settings/actions/setting.js
+++ b/src/settings/actions/setting.js
@@ -4,8 +4,9 @@ import DefaultSettings from 'shared/default-settings';
const load = () => {
return browser.storage.local.get('settings').then((value) => {
- if (value.settings) {
- return set(value.settings);
+ let settings = value.settings;
+ if (settings) {
+ return set(settings);
}
return set(DefaultSettings);
}, console.error);
@@ -13,7 +14,7 @@ const load = () => {
const save = (settings) => {
return browser.storage.local.set({
- settings
+ settings,
}).then(() => {
return browser.runtime.sendMessage({
type: messages.SETTINGS_RELOAD
@@ -24,8 +25,9 @@ const save = (settings) => {
const set = (settings) => {
return {
type: actions.SETTING_SET_SETTINGS,
- settings,
+ json: settings.json,
+ value: JSON.parse(settings.json),
};
};
-export { load, save, set };
+export { load, save };