Fix subscription in the store

We are back to having instant data
This commit is contained in:
Eli Ribble 2026-03-22 07:57:55 +00:00
parent 6cd5821e5f
commit 674801c8b2
No known key found for this signature in database
3 changed files with 14 additions and 3 deletions

View file

@ -1,7 +1,8 @@
import { defineStore } from "pinia";
import { ref, computed } from "vue";
import { useUserStore } from "./user";
import { Communication } from "../types";
import { SSEManager } from "../SSEManager";
import { useUserStore } from "./user";
export const useCommunicationStore = defineStore("communication", () => {
// State
@ -9,6 +10,12 @@ export const useCommunicationStore = defineStore("communication", () => {
const loading = ref(false);
const error = ref(null);
// Subscription
SSEManager.subscribe("*", (e) => {
if (e.resource.startsWith("rmo")) {
fetchAll();
}
});
// Actions
async function fetchAll() {
const userStore = useUserStore();