token修改
This commit is contained in:
parent
1063d79d50
commit
ce49dfe013
@ -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 {
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user