luoyali 9 сар өмнө
parent
commit
d9e9c644f5

+ 1 - 5
src/layout/components/Header/components/Message.vue

@@ -21,7 +21,7 @@
 import { onMounted, onBeforeUnmount, ref } from 'vue'
 import { EventSourcePolyfill } from 'event-source-polyfill'
 import { ls } from '@/utils'
-import { ElMessageBox, ElNotification } from 'element-plus'
+import { ElNotification } from 'element-plus'
 const token = ls.get('token')
 const { VITE_APP_BASE_API } = import.meta.env
 const serviceUrlApi = ref(`${VITE_APP_BASE_API}/sys/sse/connect`)
@@ -29,9 +29,6 @@ const receivedData = ref([])
 let eventSource = null
 
 onMounted(() => {
-	if (!token) {
-		return ElMessageBox.alert('当前页面已失效,请重新登录', '提示', {})
-	}
 	eventSource = new EventSourcePolyfill(serviceUrlApi.value, {
 		headers: { accessToken: token }
 	})
@@ -49,7 +46,6 @@ onMounted(() => {
 
 	eventSource.onerror = error => {
 		console.error('EventSource failed:', error)
-		ElMessageBox.alert('当前通讯连接已失效,请重新登录', '提示', {})
 	}
 })