From 118731d5e48871c0a32bfbf065f45ded09414429 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 13 Nov 2024 07:30:19 +0000 Subject: [PATCH] refactor: review comments --- packages/nc-gui/composables/useGlobal/actions.ts | 3 +-- packages/nc-gui/store/notification.ts | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/nc-gui/composables/useGlobal/actions.ts b/packages/nc-gui/composables/useGlobal/actions.ts index 0da1f4e2d9..fbd2c236d3 100644 --- a/packages/nc-gui/composables/useGlobal/actions.ts +++ b/packages/nc-gui/composables/useGlobal/actions.ts @@ -73,8 +73,6 @@ export function useGlobalActions(state: State, getters: Getters): Actions { const nuxtApp = useNuxtApp() const t = nuxtApp.vueApp.i18n.global.t - isTokenRefreshInProgress.value = true - if (!axiosInstance) { axiosInstance = nuxtApp.$api?.instance } @@ -101,6 +99,7 @@ export function useGlobalActions(state: State, getters: Getters): Actions { const refreshToken = useSharedExecutionFn('refreshToken', _refreshToken, { timeout: 10000, + storageDelay: 1000 }) const loadAppInfo = async () => { diff --git a/packages/nc-gui/store/notification.ts b/packages/nc-gui/store/notification.ts index 034e1fd817..2e3a4dc554 100644 --- a/packages/nc-gui/store/notification.ts +++ b/packages/nc-gui/store/notification.ts @@ -6,8 +6,6 @@ import { useStorage } from '@vueuse/core' const CancelToken = axios.CancelToken export const useNotification = defineStore('notificationStore', () => { - const isTokenRefreshInProgress = useStorage(TOKEN_REFRESH_PROGRESS_KEY, false) - const readNotifications = ref([]) const unreadNotifications = ref([]) @@ -195,7 +193,6 @@ export const useNotification = defineStore('notificationStore', () => { cancelTokenSource = null // wait if refresh token generation is in progress and cancel the polling after that // set a timeout of 10 seconds to avoid hanging - await until(isTokenRefreshInProgress).toMatch((v) => !v, { timeout: 10000 }) source?.cancel() }