Commit 657bedff authored by 李明环(东信)'s avatar 李明环(东信)

请求拦截器添加token

parent 42973fc5
import axios from "axios";
import { getToken } from "./token";
const baseURL = "https://lygsh-api.wjzpgz.com/";
// 创建一个 axios 实例
const instance = axios.create({
......@@ -18,8 +19,8 @@ instance.interceptors.request.use(
// if (token) {
// config.headers.Authorization = `Bearer ${token}`;
// }·
const token =
"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxNTU4NTExMDY1NSIsInVzZXJ0eXBlIjoiY29uc3VtZXIiLCJleHAiOjE3MjMxMDAzMzUsImNyZWF0ZWQiOjE3MjE4MDQzMzU5MjAsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJDT05TVU1FUiJ9XX0.5ONGQaDC6G5yChBuUC4Q9P-HucdArrBBy_rLSGKCu43XxmMgE4dONYoqJ86GwuqPqtV5RayLA5YKTCe8atgVCQ";
const token = getToken();
config.headers.Authorization = `Bearer ` + token;
return config;
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment