From 09340ed4faae8edc4589c6dd61a3fbbcc83283e1 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Thu, 6 Feb 2025 18:54:13 +0530 Subject: [PATCH] Fixed: logout loader not dismissing in case of user without access (#669) --- src/store/modules/user/actions.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index d38206ae..46ea7c9f 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -53,7 +53,6 @@ const actions: ActionTree = { } } - emitter.emit("presentLoader", { message: "Logging in...", backdropDismiss: false }) const api_key = await UserService.login(token) const userProfile = await UserService.getUserProfile(api_key); @@ -74,9 +73,7 @@ const actions: ActionTree = { commit(types.USER_INFO_UPDATED, userProfile); if(hasPermission("APP_DRAFT_VIEW")) await dispatch("fetchProductStores") await dispatch('getFieldMappings') - emitter.emit("dismissLoader") } catch (err: any) { - emitter.emit("dismissLoader") logger.error("error", err); return Promise.reject(new Error(err)) } @@ -85,8 +82,8 @@ const actions: ActionTree = { /** * Logout user */ - async logout({ commit, dispatch }) { - emitter.emit('presentLoader', { message: 'Logging out', backdropDismiss: false }) + async logout({ commit, dispatch }, payload = { isUserUnauthorised: false }) { + if(!payload.isUserUnauthorised) emitter.emit('presentLoader', { message: 'Logging out', backdropDismiss: false }) const authStore = useAuthStore()