From 1d852da351313c2b2366d0f125de294172516f3c Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期二, 15 十月 2024 13:47:39 +0800 Subject: [PATCH] !150 增加SEE开关 Merge pull request !150 from iqitao/ss --- .env.development | 3 +++ .env.production | 3 +++ src/utils/sse.ts | 4 ++++ 3 files changed, 10 insertions(+), 0 deletions(-) diff --git a/.env.development b/.env.development index 05d6778..14e1335 100644 --- a/.env.development +++ b/.env.development @@ -30,3 +30,6 @@ # websocket 寮�鍏� 榛樿浣跨敤sse鎺ㄩ�� VITE_APP_WEBSOCKET = false + +# sse 寮�鍏� +VITE_APP_SSE = true diff --git a/.env.production b/.env.production index c6b1f85..1109bc6 100644 --- a/.env.production +++ b/.env.production @@ -33,3 +33,6 @@ # websocket 寮�鍏� 榛樿浣跨敤sse鎺ㄩ�� VITE_APP_WEBSOCKET = false + +# sse 寮�鍏� +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