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