Compare commits

...

1 Commits

Author SHA1 Message Date
tao
674c1c715d 调整SSE心跳时间
优化全局环境配置
2025-11-03 17:16:30 +08:00
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; code: 200 | 201 | 300 | 400 | 500;
} }
interface logItem { export interface logItem {
message: string; message: string;
type?: "success" | "error" | "log"; type?: "success" | "error" | "log";
} }
@@ -126,10 +126,11 @@ export function useSSE(options: SSEOptions) {
}, options.timeout || 10000); // 默认10秒超时 }, options.timeout || 10000); // 默认10秒超时
// 创建EventSource // 创建EventSource
const eventSourceOptions = { const eventSourceOptions = {
headers: { headers: {
'Authorization': `Bearer ${getToken()}`, Authorization: `Bearer ${getToken()}`,
} },
heartbeatTimeout: 90 * 60 * 1000,
}; };
eventSource = new EventSourcePolyfill(connectUrl, eventSourceOptions); eventSource = new EventSourcePolyfill(connectUrl, eventSourceOptions);