Distinguish between status messages and resource messages in SSE
This commit is contained in:
parent
38359e20e9
commit
52c41e29d8
14 changed files with 106 additions and 41 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue