This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new d3689766f fix: reapply #5020 (#5069)
d3689766f is described below

commit d3689766f6c1b5b1e5a6c4d05a88313f073722d3
Author: Klesh Wong <[email protected]>
AuthorDate: Fri Apr 28 23:22:54 2023 +0800

    fix: reapply #5020 (#5069)
---
 config-ui/src/utils/request.ts | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/config-ui/src/utils/request.ts b/config-ui/src/utils/request.ts
index 3c26ba34c..388236481 100644
--- a/config-ui/src/utils/request.ts
+++ b/config-ui/src/utils/request.ts
@@ -64,15 +64,16 @@ export const request = (path: string, config?: 
ReuqestConfig) => {
 
   const cancelTokenSource = axios.CancelToken.source();
   const token = localStorage.getItem('accessToken');
+  const h = { ...headers };
+  if (token) {
+    h.Authorization = `Bearer ${token}`;
+  }
 
   const params: any = {
     url: path,
     method,
     timeout,
-    headers: {
-      ...headers,
-      Authorization: token ? `Bearer ${token}` : '',
-    },
+    headers: h,
     cancelToken: cancelTokenSource?.token,
   };
 

Reply via email to