mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-04 23:18:44 +08:00
fix(message): add delay to prevent 403
This commit is contained in:
@@ -16,15 +16,18 @@ const appsMenu = ref(false)
|
|||||||
|
|
||||||
// SSE持续接收消息
|
// SSE持续接收消息
|
||||||
function startSSEMessager() {
|
function startSSEMessager() {
|
||||||
eventSource = new EventSource(`${import.meta.env.VITE_API_BASE_URL}system/message`)
|
// 延迟 3 秒启动 SSE,避免相关认证信息尚未写入 Cookie 导致 403
|
||||||
eventSource.addEventListener('message', event => {
|
setTimeout(() => {
|
||||||
if (event.data) {
|
eventSource = new EventSource(`${import.meta.env.VITE_API_BASE_URL}system/message`)
|
||||||
const noti: SystemNotification = JSON.parse(event.data)
|
eventSource.addEventListener('message', event => {
|
||||||
notificationList.value.unshift(noti)
|
if (event.data) {
|
||||||
hasNewMessage.value = true
|
const noti: SystemNotification = JSON.parse(event.data)
|
||||||
// TODO 在顶部显示消息汽泡
|
notificationList.value.unshift(noti)
|
||||||
}
|
hasNewMessage.value = true
|
||||||
})
|
// TODO 在顶部显示消息汽泡
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, 3000)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 页面加载时,加载当前用户数据
|
// 页面加载时,加载当前用户数据
|
||||||
|
|||||||
Reference in New Issue
Block a user