token修改

This commit is contained in:
王东 2024-05-27 17:24:34 +08:00
parent 1063d79d50
commit ce49dfe013
2 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ export const request: RequestConfig = {
const token = localStorage.getItem('authToken'); // 从某处获取你的认证token例如localStorage const token = localStorage.getItem('authToken'); // 从某处获取你的认证token例如localStorage
if (token) { if (token) {
const headers = { const headers = {
Authorization: `Bearer ${token}`, Authorization: `${token}`,
...options.headers, ...options.headers,
}; };
return { return {

View File

@ -10,7 +10,7 @@ const http = axios.create({
// 请求拦截注入token // 请求拦截注入token
const token = getToken() const token = getToken()
if (token) { if (token) {
config.headers.Authorization = `Bearer ${token}` config.headers.Authorization = `${token}`
} }
return config return config