feat: 登录/注册接口对接

This commit is contained in:
zhangyh
2025-10-27 11:08:26 +08:00
parent a31e529ea9
commit 0fb4ca004a
7 changed files with 111 additions and 93 deletions

View File

@@ -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 请根据实际情况自行修改
}