Lijy 1 år sedan
förälder
incheckning
9872e21cd8

+ 5 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/type.d.ts

@@ -3,4 +3,9 @@ interface GlobalPopup extends Notify {
   showError: (message?: string) => void;
   showWarning: (message: string) => void;
   showInfo: (message: string) => void;
+}
+
+interface Tree {
+  label: string
+  children?: Tree[]
 }

+ 4 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/utils/request.ts

@@ -2,6 +2,7 @@ import axios from "axios";
 import { showMessage } from "./errorStatusCode"; // 引入状态码文件
 import type { AxiosRequestConfig, AxiosResponse, AxiosError } from "axios";
 import { ElNotification } from "element-plus";
+import { useStore } from "../store/index";
 const baseURL = "/api";
 // 创建axios实例
 const instance = axios.create({
@@ -12,8 +13,10 @@ const instance = axios.create({
 instance.interceptors.request.use(
   (config: AxiosRequestConfig): any => {
     // 可在请求发送前对config进行修改,如添加请求头等
+    const { getToken } = useStore()
+    const token = getToken
     const headers = config.headers || {};
-    headers["Authorization"] = "Bxxx";
+    headers["Token"] = token;
     config.headers = headers;
     return config;
   },