This commit is contained in:
caozehui
2024-11-19 16:01:35 +08:00
parent dd527a4994
commit 17b68cbc95
5 changed files with 15 additions and 5 deletions

View File

@@ -42,7 +42,7 @@ class RequestHttp {
config.loading ?? (config.loading = true)
config.loading && showFullScreenLoading()
if (config.headers && typeof config.headers.set === 'function') {
config.headers.set('x-access-token', userStore.token)
config.headers.set('Authorization', 'Bearer '+userStore.token)
}
return config
},
@@ -63,6 +63,7 @@ class RequestHttp {
// 登陆失效
if (data.code == ResultEnum.OVERDUE) {
userStore.setToken('')
userStore.setUserInfo({name: ''})
router.replace(LOGIN_URL)
ElMessage.error(data.message)
return Promise.reject(data)

View File

@@ -8,6 +8,9 @@ export namespace Login {
}
export interface ResLogin {
accessToken: string;
userInfo:{
name: string;
}
}
export interface ResAuthButtons {
[key: string]: string[];