改进 Token 刷新
All checks were successful
Build / build (push) Successful in 3m45s

This commit is contained in:
ivamp 2024-11-06 18:11:39 +08:00
parent b0f52ca420
commit 1cf70e6bb4
2 changed files with 8 additions and 6 deletions

View File

@ -3,7 +3,6 @@
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
// biome-ignore lint: disable
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
@ -106,7 +105,6 @@ declare module 'vue' {
readonly onServerPrefetch: UnwrapRef<typeof import('vue')['onServerPrefetch']>
readonly onUnmounted: UnwrapRef<typeof import('vue')['onUnmounted']>
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
readonly onWatcherCleanup: UnwrapRef<typeof import('vue')['onWatcherCleanup']>
readonly provide: UnwrapRef<typeof import('vue')['provide']>
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
readonly readonly: UnwrapRef<typeof import('vue')['readonly']>
@ -124,12 +122,9 @@ declare module 'vue' {
readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
readonly useId: UnwrapRef<typeof import('vue')['useId']>
readonly useModel: UnwrapRef<typeof import('vue')['useModel']>
readonly useRoute: UnwrapRef<typeof import('vue-router/auto')['useRoute']>
readonly useRouter: UnwrapRef<typeof import('vue-router/auto')['useRouter']>
readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
readonly useTemplateRef: UnwrapRef<typeof import('vue')['useTemplateRef']>
readonly watch: UnwrapRef<typeof import('vue')['watch']>
readonly watchEffect: UnwrapRef<typeof import('vue')['watchEffect']>
readonly watchPostEffect: UnwrapRef<typeof import('vue')['watchPostEffect']>

View File

@ -5,6 +5,7 @@ import error401 from "@/pages/errors/401.vue";
import error404 from "@/pages/errors/404.vue";
import error400 from "@/pages/errors/400.vue";
import error500 from "@/pages/errors/500.vue";
import { useUserStore } from "@/stores/user";
const osThemeRef = useOsTheme();
@ -19,13 +20,19 @@ const { dialog, loadingBar } = createDiscreteApi(
);
const request = {
onFulfilled: (config: any) => {
onFulfilled: async (config: any) => {
if (config.headers === undefined) {
config.headers = {};
}
loadingBar.start();
const userStore = useUserStore();
if (userStore.logined) {
userStore.checkAndRefresh();
}
return Promise.resolve(config);
},
onRejected: (error: any) => {