From d5846fc94573f1c2156230d9cdf2da45e4e12c46 Mon Sep 17 00:00:00 2001
From: gerson <1405270578@qq.com>
Date: 星期日, 09 二月 2025 16:43:09 +0800
Subject: [PATCH] 主题对接

---
 src/utils/request.ts |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/utils/request.ts b/src/utils/request.ts
index 0747b4a..6c8eace 100644
--- a/src/utils/request.ts
+++ b/src/utils/request.ts
@@ -35,7 +35,7 @@
 	}
 	return !!accessSession;
 };
-
+export const SESSION_KEY = 'hswatersession';
 export const handleNoAuth = debounce(() => {
 	emitNoAuth();
 });
@@ -47,7 +47,7 @@
 			const accessSession = Local.get(accessSessionKey);
 			if (accessSession) {
 				// 灏� token 娣诲姞鍒拌姹傛姤鏂囧ご涓�
-				config.headers['hswatersession'] = accessSession;
+				config.headers[SESSION_KEY] = accessSession;
 			}
 			if (!NO_AUTH_API_LIST.includes(config.url) && !isSharePage.value) {
 				if (!accessSession && config.url !== LOGIN_URL && config.url !== TEL_LOGIN_URL) {
@@ -212,7 +212,7 @@
  * @description 鍩熷悕鍓嶇紑
  * 闃叉绫讳技浜� http://sqi.beng35.com/airp 鍜� http://sqi.beng35.com/test 鍏敤鍚屼竴涓� token 鎴� userInfo
  */
-export const getDomainPrefix = (win: Window) => {
+export const getDomainPrefix = (win: Window = window) => {
 	const subDomainName = win.location.pathname
 		.split('/')
 		.filter((item) => !!item)
@@ -221,15 +221,17 @@
 	return domainPrefix;
 };
 
+export const domainPrefix = getDomainPrefix(window);
+
 // token 閿畾涔�
 export const sessionName = 'access-session';
 export const userName = 'userName';
 
 export const getSessionKey = (win: Window) => {
-	return getDomainPrefix(win) + sessionName;
+	return  sessionName;
 };
 export const getUserNameKey = (win: Window) => {
-	return getDomainPrefix(win) + userName;
+	return  userName;
 };
 
 export const accessSessionKey = getSessionKey(window);
@@ -238,7 +240,7 @@
 export const refreshAccessTokenKey = `x-${accessSessionKey}`;
 
 // userInfo閿畾涔�
-export const userInfoKey = getDomainPrefix(window) + 'userInfo';
+export const userInfoKey ='userInfo';
 // 鑾峰彇 token
 export const getSession = () => {
 	return Local.get(accessSessionKey);

--
Gitblit v1.9.3