diff options
| author | Egor Kislitsyn <egor@kislitsyn.com> | 2018-12-10 22:36:25 +0700 |
|---|---|---|
| committer | Egor Kislitsyn <egor@kislitsyn.com> | 2018-12-10 22:36:25 +0700 |
| commit | ee70ec4c7efb49c08f0a76b6b2694c0e9910978c (patch) | |
| tree | 331f83c011e51d743506fb35e1c5d498b299e9d3 /src/modules/pushNotifications.js | |
| parent | 73b17d70ec3a9b1d73789c236601628bfa8c498b (diff) | |
fix race condition
Diffstat (limited to 'src/modules/pushNotifications.js')
| -rw-r--r-- | src/modules/pushNotifications.js | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/modules/pushNotifications.js b/src/modules/pushNotifications.js deleted file mode 100644 index ea92f811..00000000 --- a/src/modules/pushNotifications.js +++ /dev/null @@ -1,36 +0,0 @@ -import registerPushNotifications from '../services/push/push.js' - -const subscribe = { - state: { - token: null, - vapidPublicKey: null - }, - mutations: { - setApiToken (state, user) { - state.token = user.credentials - }, - setVapidPublicKey (state, vapidPublicKey) { - state.vapidPublicKey = vapidPublicKey - } - }, - actions: { - setInstanceOption (store, { name, value }) { - if (name === 'vapidPublicKey') { - store.commit('setVapidPublicKey', value) - - if (store.state.token) { - registerPushNotifications(store.rootState.config.webPushNotifications, value, store.state.token) - } - } - }, - setCurrentUser (store, user) { - store.commit('setApiToken', user.credentials) - - if (store.state.vapidPublicKey) { - registerPushNotifications(store.rootState.config.webPushNotifications, store.state.vapidPublicKey, user.credentials) - } - } - } -} - -export default subscribe |
