From bbb3cafb40aeb6ff9e7717022185b1173b5b3c17 Mon Sep 17 00:00:00 2001 From: gerson <1405270578@qq.com> Date: 星期一, 12 八月 2024 19:09:27 +0800 Subject: [PATCH] config.headers['hswatersession'] = accessSession; --- src/utils/request.ts | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/utils/request.ts b/src/utils/request.ts index 3633f0e..18fb6d9 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -43,15 +43,14 @@ (config) => { // 鑾峰彇鏈湴鐨� token const accessSession = Local.get(accessSessionKey); + if (accessSession) { + // 灏� token 娣诲姞鍒拌姹傛姤鏂囧ご涓� + config.headers['hswatersession'] = accessSession; + } if (!NO_AUTH_API_LIST.includes(config.url)) { - if (accessSession) { - // 灏� token 娣诲姞鍒拌姹傛姤鏂囧ご涓� - config.headers['hswatersession'] = accessSession; - } else { - if (config.url !== LOGIN_URL && config.url !== TEL_LOGIN_URL) { - handleNoAuth(config.url); - throw '鏉冮檺楠岃瘉澶辫触'; - } + if (!accessSession && config.url !== LOGIN_URL && config.url !== TEL_LOGIN_URL) { + handleNoAuth(config.url); + throw '鏉冮檺楠岃瘉澶辫触'; } } -- Gitblit v1.9.3