diff --git a/src/drawApp/lineApp.ts b/src/drawApp/lineApp.ts index 1073ca6..034a238 100644 --- a/src/drawApp/lineApp.ts +++ b/src/drawApp/lineApp.ts @@ -267,12 +267,12 @@ export function cancelSubscribe(lineApp: IGraphicApp) { if (lineId) { lineApp.unsubscribe(`/queue/line/${lineId}/device`); lineApp.unsubscribe(`/queue/line/${lineId}/train`); - const userStore = useUserStore(); - getMonitorPath(userStore.roles).destinations.forEach((destination) => { + monitorDestinations.forEach((destination) => { lineApp.unsubscribe(destination); }); } } +let monitorDestinations: string[] = []; function handleSubscribe(lineApp: IGraphicApp) { const lineStore = useLineStore(); const lineId = lineStore.lineId; @@ -327,7 +327,8 @@ function handleSubscribe(lineApp: IGraphicApp) { }); const lineNetStore = useLineNetStore(); const userStore = useUserStore(); - getMonitorPath(userStore.roles).destinations.forEach((destination) => { + monitorDestinations = getMonitorPath(userStore.roles).destinations; + monitorDestinations.forEach((destination) => { lineApp.subscribe({ destination, messageHandle: (message: Uint8Array) => { diff --git a/src/drawApp/lineNetApp.ts b/src/drawApp/lineNetApp.ts index e513184..ab23b88 100644 --- a/src/drawApp/lineNetApp.ts +++ b/src/drawApp/lineNetApp.ts @@ -151,11 +151,12 @@ export async function loadLineNetDatas(): Promise { export function cancelSubscribe(lineNetApp: IGraphicApp) { lineNetApp.unsubscribe('/queue/lineNet'); - const userStore = useUserStore(); - getMonitorPath(userStore.roles).destinations.forEach((destination) => { + monitorDestinations.forEach((destination) => { lineNetApp.unsubscribe(destination); }); } + +let monitorDestinations: string[] = []; export function handleSubscribe(lineNetApp: IGraphicApp) { const lineNetStore = useLineNetStore(); lineNetApp.enableWsMassaging({ @@ -175,7 +176,8 @@ export function handleSubscribe(lineNetApp: IGraphicApp) { }, }); const userStore = useUserStore(); - getMonitorPath(userStore.roles).destinations.forEach((destination) => { + monitorDestinations = getMonitorPath(userStore.roles).destinations; + monitorDestinations.forEach((destination) => { lineNetApp.subscribe({ destination, messageHandle: (message: Uint8Array) => {