feat: 登录/注册接口对接
This commit is contained in:
@@ -6,6 +6,18 @@ import { getLocal } from '@/utils/local'
|
||||
import router from '@/router/index'
|
||||
import { useOverallStore } from '@/stores'
|
||||
|
||||
// 扩展 AxiosRequestConfig 接口
|
||||
declare module 'axios' {
|
||||
interface AxiosRequestConfig {
|
||||
loading?: boolean
|
||||
loadingDom?: any
|
||||
repeatRequest?: boolean
|
||||
meta?: {
|
||||
responseAll?: boolean
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 创建axios实例
|
||||
// console.log(import.meta.env,123)
|
||||
@@ -36,7 +48,7 @@ service.interceptors.request.use(
|
||||
}
|
||||
// 如果登录了,有token,则请求携带token
|
||||
// Do something before request is sent
|
||||
if (store.token) {
|
||||
if (store.state.token) {
|
||||
config.headers.Authorization = getLocal('token') // 让每个请求携带token--['X-Token']为自定义key 请根据实际情况自行修改
|
||||
// config.headers['X-Token'] = getLocal('token') // 让每个请求携带token--['X-Token']为自定义key 请根据实际情况自行修改
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user