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开关

---
 src/utils/sse.ts |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/utils/sse.ts b/src/utils/sse.ts
index 7db4aa7..9174f0d 100644
--- a/src/utils/sse.ts
+++ b/src/utils/sse.ts
@@ -2,13 +2,12 @@
 import { ElNotification } from 'element-plus';
 import useNoticeStore from '@/store/modules/notice';
 
-let message = '';
-
 // 鍒濆鍖�
 export const initSSE = (url: any) => {
-  if (import.meta.env.VITE_APP_WEBSOCKET === 'false') {
+  if (import.meta.env.VITE_APP_SSE === 'false') {
     return;
   }
+
   url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID
   const {
     data,
@@ -18,13 +17,13 @@
       retries: 10,
       delay: 3000,
       onFailed() {
-        console.log('Failed to connect after 10 retries')
-      },
+        console.log('Failed to connect after 10 retries');
+      }
     }
   });
 
   watch(error, () => {
-    console.log('SSE connection error:', error.value)
+    console.log('SSE connection error:', error.value);
     error.value = null;
   });
 
@@ -44,5 +43,3 @@
     data.value = null;
   });
 };
-
-

--
Gitblit v1.9.3