调整SSE心跳时间

优化全局环境配置
This commit is contained in:
tao
2025-11-03 17:16:30 +08:00
parent 2107dfa261
commit 674c1c715d
2 changed files with 7 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
# 开发环境
VITE_APP_BASE_API='/api'
VITE_APP_BASE_API=/api
VITE_APP_BASE_URL='http://192.168.1.38:18081'
VITE_APP_BASE_URL=http://192.168.1.38:18081

View File

@@ -12,7 +12,7 @@ interface EventData {
code: 200 | 201 | 300 | 400 | 500;
}
interface logItem {
export interface logItem {
message: string;
type?: "success" | "error" | "log";
}
@@ -126,10 +126,11 @@ export function useSSE(options: SSEOptions) {
}, options.timeout || 10000); // 默认10秒超时
// 创建EventSource
const eventSourceOptions = {
const eventSourceOptions = {
headers: {
'Authorization': `Bearer ${getToken()}`,
}
Authorization: `Bearer ${getToken()}`,
},
heartbeatTimeout: 90 * 60 * 1000,
};
eventSource = new EventSourcePolyfill(connectUrl, eventSourceOptions);