aboutsummaryrefslogtreecommitdiff
path: root/src/modules/interface.js
diff options
context:
space:
mode:
authorShpuld Shpuldson <shp@cock.li>2020-07-07 17:34:35 +0300
committerShpuld Shpuldson <shp@cock.li>2020-07-07 17:34:35 +0300
commitddde05771fdda8e07ff757c3469ab981ef2be295 (patch)
tree6270c5f68038b8e75b340f6d03c69d4e562847c5 /src/modules/interface.js
parent77bb31b474f16aa2bbda66e2aa73cf0d20eb934e (diff)
parent7206fee4372eba5bb05db9eb90100aee95003962 (diff)
update with bookmarks, clean up some code
Diffstat (limited to 'src/modules/interface.js')
-rw-r--r--src/modules/interface.js31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/modules/interface.js b/src/modules/interface.js
index eeebd65e..e31630fc 100644
--- a/src/modules/interface.js
+++ b/src/modules/interface.js
@@ -14,7 +14,8 @@ const defaultState = {
window.CSS.supports('-webkit-filter', 'drop-shadow(0 0)')
)
},
- mobileLayout: false
+ mobileLayout: false,
+ globalNotices: []
}
const interfaceMod = {
@@ -58,6 +59,12 @@ const interfaceMod = {
if (!state.settingsModalLoaded) {
state.settingsModalLoaded = true
}
+ },
+ pushGlobalNotice (state, notice) {
+ state.globalNotices.push(notice)
+ },
+ removeGlobalNotice (state, notice) {
+ state.globalNotices = state.globalNotices.filter(n => n !== notice)
}
},
actions: {
@@ -81,6 +88,28 @@ const interfaceMod = {
},
togglePeekSettingsModal ({ commit }) {
commit('togglePeekSettingsModal')
+ },
+ pushGlobalNotice (
+ { commit, dispatch },
+ {
+ messageKey,
+ messageArgs = {},
+ level = 'error',
+ timeout = 0
+ }) {
+ const notice = {
+ messageKey,
+ messageArgs,
+ level
+ }
+ if (timeout) {
+ setTimeout(() => dispatch('removeGlobalNotice', notice), timeout)
+ }
+ commit('pushGlobalNotice', notice)
+ return notice
+ },
+ removeGlobalNotice ({ commit }, notice) {
+ commit('removeGlobalNotice', notice)
}
}
}