From 1644070e97af5df11a9cc655a93f4e3e778ae879 Mon Sep 17 00:00:00 2001
From: 陈西瓜i <5785714@qq.com>
Date: 星期一, 14 十月 2024 20:33:16 +0800
Subject: [PATCH] add SSE开关

---
 .env.development |    1 +
 .env.production  |    1 +
 src/utils/sse.ts |    4 ++++
 3 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/.env.development b/.env.development
index 05d6778..e94d5fa 100644
--- a/.env.development
+++ b/.env.development
@@ -30,3 +30,4 @@
 
 # websocket 寮�鍏� 榛樿浣跨敤sse鎺ㄩ��
 VITE_APP_WEBSOCKET = false
+VITE_APP_SSE = true
diff --git a/.env.production b/.env.production
index c6b1f85..0b487f6 100644
--- a/.env.production
+++ b/.env.production
@@ -33,3 +33,4 @@
 
 # websocket 寮�鍏� 榛樿浣跨敤sse鎺ㄩ��
 VITE_APP_WEBSOCKET = false
+VITE_APP_SSE = true
diff --git a/src/utils/sse.ts b/src/utils/sse.ts
index 0f74d0e..9174f0d 100644
--- a/src/utils/sse.ts
+++ b/src/utils/sse.ts
@@ -4,6 +4,10 @@
 
 // 鍒濆鍖�
 export const initSSE = (url: any) => {
+  if (import.meta.env.VITE_APP_SSE === 'false') {
+    return;
+  }
+
   url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID
   const {
     data,

--
Gitblit v1.9.3