feat:完成登录功能
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
|
||||
import axios from 'axios';
|
||||
import { getToken } from '@/utils/auth'
|
||||
export let isRelogin = { show: false };
|
||||
// import JsonBig from 'json-bigint'
|
||||
const myaxios = axios.create({
|
||||
baseURL:import.meta.env.VITE_APP_BASEAPI,
|
||||
@@ -17,12 +19,12 @@ const myaxios = axios.create({
|
||||
// }
|
||||
// }
|
||||
// }],
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + ""
|
||||
},
|
||||
})
|
||||
// 请求拦截器
|
||||
myaxios.interceptors.request.use(function (config) {
|
||||
if (getToken()) {
|
||||
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config;
|
||||
}, function (error) {
|
||||
return Promise.reject(error);
|
||||
|
||||
Reference in New Issue
Block a user