fix race condition
This commit is contained in:
parent
73b17d70ec
commit
ee70ec4c7e
4 changed files with 21 additions and 44 deletions
11
src/main.js
11
src/main.js
|
@ -10,7 +10,6 @@ import apiModule from './modules/api.js'
|
|||
import configModule from './modules/config.js'
|
||||
import chatModule from './modules/chat.js'
|
||||
import oauthModule from './modules/oauth.js'
|
||||
import pushNotificationsModule from './modules/pushNotifications.js'
|
||||
|
||||
import VueTimeago from 'vue-timeago'
|
||||
import VueI18n from 'vue-i18n'
|
||||
|
@ -61,13 +60,19 @@ createPersistedState(persistedStateOptions).then((persistedState) => {
|
|||
api: apiModule,
|
||||
config: configModule,
|
||||
chat: chatModule,
|
||||
oauth: oauthModule,
|
||||
pushNotifications: pushNotificationsModule
|
||||
oauth: oauthModule
|
||||
},
|
||||
plugins: [persistedState],
|
||||
strict: false // Socket modifies itself, let's ignore this for now.
|
||||
// strict: process.env.NODE_ENV !== 'production'
|
||||
})
|
||||
|
||||
store.subscribe((mutation, state) => {
|
||||
if ((mutation.type === 'setCurrentUser' && state.instance.vapidPublicKey) || // Login + existing key
|
||||
(mutation.type === 'setInstanceOption' && mutation.payload.name === 'vapidPublicKey' && state.users.currentUser)) { // Logged in, key arrives late
|
||||
store.dispatch('registerPushNotifications')
|
||||
}
|
||||
})
|
||||
|
||||
afterStoreSetup({ store, i18n })
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue