Browse Source

refactor: review comments

pull/9784/head
Pranav C 2 weeks ago
parent
commit
118731d5e4
  1. 3
      packages/nc-gui/composables/useGlobal/actions.ts
  2. 3
      packages/nc-gui/store/notification.ts

3
packages/nc-gui/composables/useGlobal/actions.ts

@ -73,8 +73,6 @@ export function useGlobalActions(state: State, getters: Getters): Actions {
const nuxtApp = useNuxtApp() const nuxtApp = useNuxtApp()
const t = nuxtApp.vueApp.i18n.global.t const t = nuxtApp.vueApp.i18n.global.t
isTokenRefreshInProgress.value = true
if (!axiosInstance) { if (!axiosInstance) {
axiosInstance = nuxtApp.$api?.instance axiosInstance = nuxtApp.$api?.instance
} }
@ -101,6 +99,7 @@ export function useGlobalActions(state: State, getters: Getters): Actions {
const refreshToken = useSharedExecutionFn('refreshToken', _refreshToken, { const refreshToken = useSharedExecutionFn('refreshToken', _refreshToken, {
timeout: 10000, timeout: 10000,
storageDelay: 1000
}) })
const loadAppInfo = async () => { const loadAppInfo = async () => {

3
packages/nc-gui/store/notification.ts

@ -6,8 +6,6 @@ import { useStorage } from '@vueuse/core'
const CancelToken = axios.CancelToken const CancelToken = axios.CancelToken
export const useNotification = defineStore('notificationStore', () => { export const useNotification = defineStore('notificationStore', () => {
const isTokenRefreshInProgress = useStorage(TOKEN_REFRESH_PROGRESS_KEY, false)
const readNotifications = ref<NotificationType[]>([]) const readNotifications = ref<NotificationType[]>([])
const unreadNotifications = ref<NotificationType[]>([]) const unreadNotifications = ref<NotificationType[]>([])
@ -195,7 +193,6 @@ export const useNotification = defineStore('notificationStore', () => {
cancelTokenSource = null cancelTokenSource = null
// wait if refresh token generation is in progress and cancel the polling after that // wait if refresh token generation is in progress and cancel the polling after that
// set a timeout of 10 seconds to avoid hanging // set a timeout of 10 seconds to avoid hanging
await until(isTokenRefreshInProgress).toMatch((v) => !v, { timeout: 10000 })
source?.cancel() source?.cancel()
} }

Loading…
Cancel
Save