aboutsummaryrefslogtreecommitdiff
path: root/src/main.js
diff options
context:
space:
mode:
authorShpuld Shpuldson <shp@cock.li>2020-07-02 10:40:41 +0300
committerShpuld Shpuldson <shp@cock.li>2020-07-02 10:40:41 +0300
commit1293bec77e5137acf64d3536c286f8ba3df284f4 (patch)
treedd95f0f93a0e54c3215491b98e2dac871fe102ff /src/main.js
parent0997e5ff668a57d58002ec646f698c5503f66c35 (diff)
change storage error one-off into a global notice system
Diffstat (limited to 'src/main.js')
-rw-r--r--src/main.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/main.js b/src/main.js
index a7294ea0..5bddc76e 100644
--- a/src/main.js
+++ b/src/main.js
@@ -62,14 +62,14 @@ const persistedStateOptions = {
};
(async () => {
- let persistedState
- let storageError = 'none'
+ let storageError = false
+ const plugins = [pushNotifications]
try {
- persistedState = await createPersistedState(persistedStateOptions)
+ const persistedState = await createPersistedState(persistedStateOptions)
+ plugins.push(persistedState)
} catch (e) {
console.error(e)
- storageError = 'show'
- persistedState = _ => _
+ storageError = true
}
const store = new Vuex.Store({
modules: {
@@ -93,11 +93,13 @@ const persistedStateOptions = {
polls: pollsModule,
postStatus: postStatusModule
},
- plugins: [persistedState, pushNotifications],
+ plugins,
strict: false // Socket modifies itself, let's ignore this for now.
// strict: process.env.NODE_ENV !== 'production'
})
- store.dispatch('setStorageError', storageError)
+ if (storageError) {
+ store.dispatch('pushGlobalNotice', { messageKey: 'errors.storage_unavailable', level: 'error' })
+ }
afterStoreSetup({ store, i18n })
})()