mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 16:22:57 +08:00
fix: 修改请求接口 token 名称
This commit is contained in:
parent
504a1f4703
commit
c311dd08e3
@ -23,10 +23,11 @@ axiosInstance.interceptors.request.use(
|
||||
if (!info) {
|
||||
routerTurnByName(PageEnum.BASE_LOGIN_NAME)
|
||||
return config
|
||||
}
|
||||
}
|
||||
const userInfo = info[SystemStoreEnum.USER_INFO]
|
||||
config.headers = {
|
||||
...config.headers,
|
||||
[RequestHttpHeaderEnum.TOKEN]: info[SystemStoreEnum.USER_INFO][SystemStoreUserInfoEnum.USER_TOKEN] || ''
|
||||
[userInfo[SystemStoreUserInfoEnum.TOKEN_NAME]]: userInfo[SystemStoreUserInfoEnum.USER_TOKEN] || ''
|
||||
}
|
||||
return config
|
||||
},
|
||||
|
@ -1,5 +1,6 @@
|
||||
export enum SystemStoreUserInfoEnum {
|
||||
USER_TOKEN = 'userToken',
|
||||
TOKEN_NAME = 'tokenName',
|
||||
USER_ID = 'userId',
|
||||
USER_NAME = 'userName',
|
||||
NICK_NAME = 'nickName',
|
||||
@ -7,6 +8,7 @@ export enum SystemStoreUserInfoEnum {
|
||||
|
||||
export interface UserInfoType {
|
||||
[SystemStoreUserInfoEnum.USER_TOKEN]?: string,
|
||||
[SystemStoreUserInfoEnum.TOKEN_NAME]?: string,
|
||||
[SystemStoreUserInfoEnum.USER_ID]?: string,
|
||||
[SystemStoreUserInfoEnum.USER_NAME]?: string,
|
||||
[SystemStoreUserInfoEnum.NICK_NAME]?: string,
|
||||
|
@ -119,7 +119,7 @@ import { reactive, ref, onMounted } from 'vue'
|
||||
import shuffle from 'lodash/shuffle'
|
||||
import { carouselInterval } from '@/settings/designSetting'
|
||||
import { useSystemStore } from '@/store/modules/systemStore/systemStore'
|
||||
import { SystemStoreEnum } from '@/store/modules/systemStore/systemStore.d'
|
||||
import { SystemStoreUserInfoEnum, SystemStoreEnum } from '@/store/modules/systemStore/systemStore.d'
|
||||
import { GoThemeSelect } from '@/components/GoThemeSelect'
|
||||
import { GoLangSelect } from '@/components/GoLangSelect'
|
||||
import { LayoutHeader } from '@/layout/components/LayoutHeader'
|
||||
@ -209,15 +209,17 @@ const handleSubmit = async (e: Event) => {
|
||||
password
|
||||
}) as unknown as MyResponseType
|
||||
if(res.data) {
|
||||
const { tokenValue } = res.data.token
|
||||
const { tokenValue, tokenName } = res.data.token
|
||||
const { nickname, username, id } = res.data.userinfo
|
||||
|
||||
// 存储到 pinia
|
||||
systemStore.setItem(SystemStoreEnum.USER_INFO, {
|
||||
userToken: tokenValue,
|
||||
userId: id,
|
||||
userName: username,
|
||||
nickName: nickname,
|
||||
[SystemStoreUserInfoEnum.USER_TOKEN]: tokenValue,
|
||||
[SystemStoreUserInfoEnum.TOKEN_NAME]: tokenName,
|
||||
[SystemStoreUserInfoEnum.USER_ID]: id,
|
||||
[SystemStoreUserInfoEnum.USER_NAME]: username,
|
||||
[SystemStoreUserInfoEnum.NICK_NAME]: nickname,
|
||||
t
|
||||
})
|
||||
|
||||
window['$message'].success(t('login.login_success'))
|
||||
|
Loading…
Reference in New Issue
Block a user