From f4b6b8d55d6e015aeb2b4adbddbc89c3281e5397 Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 18 Sep 2021 09:28:00 +0800 Subject: [PATCH] =?UTF-8?q?401=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C?= =?UTF-8?q?=E6=B8=85=E7=90=86token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/index.ts | 1 - src/utils/request.ts | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/index.ts b/src/store/index.ts index bec1ff0..ebd3b2d 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -26,7 +26,6 @@ export default createStore({ isLogin: (state: State): boolean => { return state.isLogin }, - // 获取组合后的token accessToken: (state: State): string => { return state.tokenType + ' ' + state.accessToken } diff --git a/src/utils/request.ts b/src/utils/request.ts index df80738..b44e42d 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -29,6 +29,7 @@ request.interceptors.request.use(axiosConf, err => { */ request.interceptors.response.use(async (response) => { if (response.status === 401 || response.data?.status_code === 401) { + await vuex.dispatch('auth/Logout') await router.push({ name: 'AuthLogin' }) }