mirror of
https://gitee.com/bootx/dax-pay-ui
synced 2026-08-11 23:25:33 +08:00
fix(admin): 请求头补齐 Accesstoken 与 Sa-Token 对齐
与后端 sa-token.token-name=Accesstoken 一致,Authorization 保留兼容; 同步更正 SSE 依赖同源 Accesstoken Cookie 的注释说明。
This commit is contained in:
@@ -52,8 +52,11 @@ function createRequestClient(baseURL: string, options?: RequestClientOptions) {
|
||||
client.addRequestInterceptor({
|
||||
fulfilled: async (config) => {
|
||||
const accessStore = useAccessStore();
|
||||
const token = accessStore.accessToken;
|
||||
|
||||
config.headers.Authorization = accessStore.accessToken;
|
||||
// 与后端 sa-token.token-name=Accesstoken 对齐; Authorization 保留兼容
|
||||
config.headers.Accesstoken = token;
|
||||
config.headers.Authorization = token;
|
||||
config.headers['Accept-Language'] = preferences.app.locale;
|
||||
config.headers['x-client-code'] = CLIENT_CODE;
|
||||
return config;
|
||||
|
||||
@@ -95,8 +95,8 @@ export const useNotifyStore = defineStore('notify', () => {
|
||||
/**
|
||||
* 建立 SSE 实时推送连接
|
||||
*
|
||||
* EventSource 不支持自定义请求头, 依赖同源 cookie 透传 Sa-Token 会话;
|
||||
* 收到推送时刷新未读数与铃铛列表.
|
||||
* EventSource 不支持自定义请求头, 依赖登录时写入的 Accesstoken 同源 Cookie
|
||||
* (withCredentials) 透传 Sa-Token 会话; 收到推送时刷新未读数与铃铛列表.
|
||||
* 防重入: 已存在活跃连接(OPEN/CONNECTING)时直接复用, 不重复建立;
|
||||
* 出错时主动关闭并改用指数退避手动重连, 避免浏览器默认的固定重连风暴.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user