|
|
@ -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() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|