add SSE开关

This commit is contained in:
陈西瓜i 2024-10-14 20:33:16 +08:00
parent 4918552492
commit 1644070e97
3 changed files with 6 additions and 0 deletions

View File

@ -30,3 +30,4 @@ VITE_APP_CLIENT_ID = 'e5cd7e4891bf95d1d19206ce24a7b32e'
# websocket 开关 默认使用sse推送
VITE_APP_WEBSOCKET = false
VITE_APP_SSE = true

View File

@ -33,3 +33,4 @@ VITE_APP_CLIENT_ID = 'e5cd7e4891bf95d1d19206ce24a7b32e'
# websocket 开关 默认使用sse推送
VITE_APP_WEBSOCKET = false
VITE_APP_SSE = true

View File

@ -4,6 +4,10 @@ import useNoticeStore from '@/store/modules/notice';
// 初始化
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,