From 9d19f1ae3bde366ea2c0de832bbe607a0b8ad052 Mon Sep 17 00:00:00 2001 From: fengyang_sy Date: Sat, 19 Nov 2022 16:18:20 +0800 Subject: [PATCH] [#issue-497]When calling the registration and login interface, the token is not carried When calling the registration and login interface, the token is not carried Signed-off-by: fengyang_sy --- src/dashboard/src/utils/request.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dashboard/src/utils/request.js b/src/dashboard/src/utils/request.js index 0f047da8a..9b4d00778 100644 --- a/src/dashboard/src/utils/request.js +++ b/src/dashboard/src/utils/request.js @@ -91,7 +91,7 @@ const request = extend({ request.interceptors.request.use(async (url, options) => { const token = window.localStorage.getItem('cello-token'); - if (token) { + if (url.indexOf('api/v1/login') < 0 && url.indexOf('api/v1/register') < 0 && token) { // 如果有token 就走token逻辑 const headers = { Authorization: `JWT ${token}`, @@ -111,7 +111,7 @@ request.interceptors.request.use(async (url, options) => { // 第一个拦截器有可能返回Promise,那么Promise由第二个拦截器处理 request.interceptors.request.use(async (url, options) => { const token = localStorage.getItem('cello-token'); - if (token) { + if (url.indexOf('api/v1/login') < 0 && url.indexOf('api/v1/register') < 0 && token) { // 如果有token 就走token逻辑 const headers = { Authorization: `JWT ${token}`,