diff --git a/src/boot/kdk.js b/src/boot/kdk.js index 2788f1df..f7208012 100644 --- a/src/boot/kdk.js +++ b/src/boot/kdk.js @@ -101,10 +101,10 @@ export default async ({ app }) => { beforeGuard.registerGuard(permissionsGuard) // updateThemeColors() - + api.on('authenticated', (data) => { - // Subscribe to webpush notifications - utils.subscribeToPushNotifications() + // User will be updated in store just after login so that we need to wait for the event + Events.once('user-changed', utils.subscribeToPushNotifications) // Store API gateway token if any if (data.gatewayToken) api.get('storage').setItem(config.gatewayJwt, data.gatewayToken) })