Skip to content

Commit

Permalink
[#issue-497]When calling the registration and login interface, the to…
Browse files Browse the repository at this point in the history
…ken is not carried

When calling the registration and login interface, the token is not carried

Signed-off-by: fengyang_sy <fengyang.09186@h3c.com>
  • Loading branch information
fengyangsy committed Nov 19, 2022
1 parent fdd24f6 commit 9d19f1a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dashboard/src/utils/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand All @@ -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}`,
Expand Down

0 comments on commit 9d19f1a

Please sign in to comment.