This commit is contained in:
syuilo
2020-10-25 01:23:23 +09:00
parent d4da5a1eea
commit 745f4d2439
5 changed files with 121 additions and 8 deletions

View File

@@ -202,6 +202,15 @@ export const store = createStore({
state: defaultDeviceSettings,
mutations: {
overwrite(state, x) {
for (const k of Object.keys(state)) {
if (x[k] === undefined) delete state[k];
}
for (const k of Object.keys(x)) {
state[k] = x[k];
}
},
set(state, x: { key: string; value: any }) {
state[x.key] = x.value;
},
@@ -218,6 +227,15 @@ export const store = createStore({
state: defaultDeviceUserSettings,
mutations: {
overwrite(state, x) {
for (const k of Object.keys(state)) {
if (x[k] === undefined) delete state[k];
}
for (const k of Object.keys(x)) {
state[k] = x[k];
}
},
init(state, x) {
for (const [key, value] of Object.entries(defaultDeviceUserSettings)) {
if (x[key]) {