Skip to content
This repository was archived by the owner on May 12, 2020. It is now read-only.

Commit 175b5e4

Browse files
committed
feat(request): invoke logout process when invalid access_token
1 parent 3fceb17 commit 175b5e4

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/utils/request.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import axios from 'axios'
22
import { tokenFromStorage } from 'UTILS/storage'
3-
// import store from 'STORE'
3+
import store from 'STORE'
44

55
/**
66
* @description 创建一个 axios 基础请求实例,提示,环境变量可在 .env.[mode] files 中定义
@@ -34,9 +34,8 @@ export default function createBaseRequest (baseURL) {
3434
// 触发 router 的 beforeEach 导航守卫中的 token 检测并重定向至 login 页
3535
tokenFromStorage.setItem('')
3636
// 以下 action 用于用户登出,并重置 vuex 状态
37-
return Promise.reject(data)
38-
// return store.dispatch('login/userLogout')
39-
// .then(() => Promise.reject(data))
37+
return store.dispatch('login/userLogout')
38+
.then(() => Promise.reject(data))
4039
}
4140
// 1.2 登录失败
4241
if (data.code === 5000) {

0 commit comments

Comments
 (0)