fix(sse): support sub-dir deployment

This commit is contained in:
Jacky 2025-05-03 08:25:46 +00:00
parent 855c3375f8
commit 1396cbf096
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
3 changed files with 8 additions and 2 deletions

View file

@ -62,7 +62,9 @@ export const useSelfCheckStore = defineStore('selfCheck', () => {
try {
await selfCheck.fix(taskName)
await nextTick()
check()
setTimeout(() => {
check()
}, 1000)
}
finally {
fixing[taskName] = false

View file

@ -1,4 +1,5 @@
import type { SSEvent } from 'sse.js'
import { urlJoin } from '@/lib/helper'
import { useUserStore } from '@/pinia'
import { SSE } from 'sse.js'
@ -37,7 +38,9 @@ export function useSSE() {
reconnectInterval = 5000,
} = options
const sse = new SSE(url, {
const fullUrl = urlJoin(window.location.pathname, url)
const sse = new SSE(fullUrl, {
headers: {
Authorization: token.value,
},