diff options
| author | Henry Jameson <me@hjkos.com> | 2018-09-07 18:17:17 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2018-09-17 17:51:39 +0300 |
| commit | f1c16327b696666f291d5fb2afdf4033cf9ef76d (patch) | |
| tree | c75ec1dd94a35dcbb3ec2af4717f833a45eff702 /src/modules/config.js | |
| parent | 7887e42fca28f16859d2046c0f9085e6f48d77d5 (diff) | |
Initial version
Diffstat (limited to 'src/modules/config.js')
| -rw-r--r-- | src/modules/config.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/modules/config.js b/src/modules/config.js index 60a34bc1..cb59acaa 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -26,7 +26,11 @@ const defaultState = { }, muteWords: [], highlight: {}, - interfaceLanguage: browserLocale + interfaceLanguage: browserLocale, + _internal: { + currentSaveStateNotice: {}, + noticeClearTimeout: null + } } const config = { @@ -42,6 +46,18 @@ const config = { } else { del(state.highlight, user) } + }, + settingsSaved (state, { success, error }) { + if (success) { + if (state.noticeClearTimeout) { + clearTimeout(state.noticeClearTimeout) + } + set(state._internal, 'currentSaveStateNotice', { error: false, data: success }) + set(state._internal, 'noticeClearTimeout', + setTimeout(() => del(state._internal, 'currentSaveStateNotice'), 2000)) + } else { + set(state._internal, 'currentSaveStateNotice', { error: true, errorData: error }) + } } }, actions: { @@ -51,6 +67,9 @@ const config = { setHighlight ({ commit, dispatch }, { user, color, type }) { commit('setHighlight', {user, color, type}) }, + settingsSaved ({ commit, dispatch }, { success, error }) { + commit('settingsSaved', { success, error }) + }, setOption ({ commit, dispatch }, { name, value }) { commit('setOption', {name, value}) switch (name) { |
