update
This commit is contained in:
@@ -4,7 +4,19 @@ import {showToast} from "./uils.js";
|
||||
import AESCrypto from "./AESCrypto.js";
|
||||
import {useUserStore} from "../pinia/UserStore/index.js";
|
||||
|
||||
export const BASEURL = import.meta.env.MODE === 'development' ? '/baseApi/api' : import.meta.env.VITE_API_URL;
|
||||
let BASEURL = null;
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
BASEURL = import.meta.env.VITE_API_URL;
|
||||
// #endif
|
||||
|
||||
// #ifndef MP-WEIXIN
|
||||
BASEURL = import.meta.env.MODE === 'development' ?
|
||||
'/baseApi/api' :
|
||||
import.meta.env.VITE_API_URL;
|
||||
// #endif
|
||||
|
||||
export {BASEURL};
|
||||
|
||||
const request = axios.create({
|
||||
baseURL: BASEURL,
|
||||
@@ -16,6 +28,7 @@ request.interceptors.request.use(
|
||||
(config) => {
|
||||
const {token} = useUserStore();
|
||||
|
||||
console.log('看看token在不在', token)
|
||||
// 如果 token 存在,则将其添加到请求头中
|
||||
if (token) {
|
||||
config.headers['Access-Token'] = token;
|
||||
|
||||
Reference in New Issue
Block a user