Distinguish between status messages and resource messages in SSE

This commit is contained in:
Eli Ribble 2026-04-28 17:06:21 +00:00
parent 38359e20e9
commit 52c41e29d8
No known key found for this signature in database
14 changed files with 106 additions and 41 deletions

View file

@ -1,7 +1,7 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import { Upload } from "@/type/api";
import { SSEManager, type SSEMessage } from "@/SSEManager";
import { SSEManager, type SSEMessageResource } from "@/SSEManager";
import { useSessionStore } from "@/store/session";
export const useUploadStore = defineStore("upload", () => {
@ -12,7 +12,7 @@ export const useUploadStore = defineStore("upload", () => {
const error = ref(null);
// Subscription
SSEManager.subscribe((msg: SSEMessage) => {
SSEManager.subscribe((msg: SSEMessageResource) => {
if (msg.resource.startsWith("sync:upload")) {
fetchAll();
}