From 364dfb969de09b97c4629e1c46b9ed9c2352da1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Mon, 7 Oct 2024 10:45:25 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/index.vue | 2 +- src/utils/sse.ts | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/layout/index.vue b/src/layout/index.vue index 0919aad..ce47a30 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -73,7 +73,7 @@ onMounted(() => { }); onMounted(() => { - initSSE(import.meta.env.VITE_APP_BASE_API + '/resource/sse') + initSSE(import.meta.env.VITE_APP_BASE_API + '/resource/sse'); }); const handleClickOutside = () => { diff --git a/src/utils/sse.ts b/src/utils/sse.ts index a08f282..0f74d0e 100644 --- a/src/utils/sse.ts +++ b/src/utils/sse.ts @@ -2,8 +2,6 @@ import { getToken } from '@/utils/auth'; import { ElNotification } from 'element-plus'; import useNoticeStore from '@/store/modules/notice'; -let message = ''; - // 初始化 export const initSSE = (url: any) => { url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID @@ -15,13 +13,13 @@ export const initSSE = (url: any) => { 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; }); @@ -41,5 +39,3 @@ export const initSSE = (url: any) => { data.value = null; }); }; - -