diff options
| author | Shpuld Shpludson <shp@cock.li> | 2020-07-05 06:53:29 +0000 |
|---|---|---|
| committer | Shpuld Shpludson <shp@cock.li> | 2020-07-05 06:53:29 +0000 |
| commit | af4a26b5882807d834c8fcfdf5d10121f63d18d5 (patch) | |
| tree | 6b56d027f3231c0a7c5a18cee1ebd6d010cd7e66 /src/modules | |
| parent | acc3b083aa46aa9c165578380b16ef86e6fb596b (diff) | |
| parent | 9cac5d94dd78ea331254307871e876da7e266a6f (diff) | |
Merge branch 'feat/allow-use-without-cookies' into 'develop'
Fix #815: Allow use without cookies, Add a global notice popup system
Closes #815
See merge request pleroma/pleroma-fe!1166
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/interface.js | 31 |
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) } } } |
