aboutsummaryrefslogtreecommitdiff
path: root/src/modules/pushNotifications.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/pushNotifications.js')
-rw-r--r--src/modules/pushNotifications.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/modules/pushNotifications.js b/src/modules/pushNotifications.js
index 43143b1f..ea92f811 100644
--- a/src/modules/pushNotifications.js
+++ b/src/modules/pushNotifications.js
@@ -12,16 +12,23 @@ const subscribe = {
setVapidPublicKey (state, vapidPublicKey) {
state.vapidPublicKey = vapidPublicKey
}
-
},
actions: {
setInstanceOption (store, { name, value }) {
- store.commit('setVapidPublicKey', value)
- if (store.state.token) registerPushNotifications(this)
+ 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(this)
+
+ if (store.state.vapidPublicKey) {
+ registerPushNotifications(store.rootState.config.webPushNotifications, store.state.vapidPublicKey, user.credentials)
+ }
}
}
}