From ec896a416b1037a94ffb8c03afdae39322a16123 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 10 Jul 2024 19:44:46 +0530 Subject: [PATCH 1/2] Improved: logic to initialize firebase only if notificationPrefs are enabled --- src/components/DxpLogin.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/DxpLogin.vue b/src/components/DxpLogin.vue index 2326043..8a2ffe8 100644 --- a/src/components/DxpLogin.vue +++ b/src/components/DxpLogin.vue @@ -93,8 +93,10 @@ async function handleUserFlow(token: string, oms: string, expirationTime: string const appState = appContext.config.globalProperties.$store await userStore.setLocale(appState.getters['user/getUserProfile'].userLocale) + const allNotificationPrefs = appState.getters['user/getAllNotificationPrefs'] + // check if firebase configurations are there - if (notificationContext.appFirebaseConfig && notificationContext.appFirebaseConfig.apiKey) { + if (notificationContext.appFirebaseConfig && notificationContext.appFirebaseConfig.apiKey && allNotificationPrefs.length) { // initialising and connecting firebase app for notification support await initialiseFirebaseApp( notificationContext.appFirebaseConfig, From 48aa33f110f656fe7c580fbd2274d71f0a666f0a Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 10 Jul 2024 19:46:36 +0530 Subject: [PATCH 2/2] Improved: added optional check to check whether allNotificationPrefs are available or not --- src/components/DxpLogin.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/DxpLogin.vue b/src/components/DxpLogin.vue index 8a2ffe8..a56e635 100644 --- a/src/components/DxpLogin.vue +++ b/src/components/DxpLogin.vue @@ -96,7 +96,7 @@ async function handleUserFlow(token: string, oms: string, expirationTime: string const allNotificationPrefs = appState.getters['user/getAllNotificationPrefs'] // check if firebase configurations are there - if (notificationContext.appFirebaseConfig && notificationContext.appFirebaseConfig.apiKey && allNotificationPrefs.length) { + if (notificationContext.appFirebaseConfig && notificationContext.appFirebaseConfig.apiKey && allNotificationPrefs?.length) { // initialising and connecting firebase app for notification support await initialiseFirebaseApp( notificationContext.appFirebaseConfig,