From a8ad167f05721c690e7362137ef725e832df1a37 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期四, 07 三月 2024 17:45:27 +0800
Subject: [PATCH] 报错jwt 的问题修改

---
 src/common/untils/request.js |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/common/untils/request.js b/src/common/untils/request.js
index 9270bbc..5da21ec 100644
--- a/src/common/untils/request.js
+++ b/src/common/untils/request.js
@@ -16,7 +16,13 @@
     // if (token != undefined) {
     //   config.headers.Authorization = "Bearer " + token;
     // }
-
+    let token = document.cookie.replace(
+      /(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/,
+      "$1",
+    );
+    if (token) {
+      config.headers.Authorization = "Bearer " + token;
+    }
     return config
   },
   (error) => {

--
Gitblit v1.8.0