added DME, fixed sync and bugs. Rewrote setDisplay logic

This commit is contained in:
PxlLoewe
2025-05-19 22:23:15 -07:00
parent 46c58ae127
commit 61e7caf6c8
23 changed files with 776 additions and 242 deletions

View File

@@ -5,6 +5,7 @@ interface ConnectionStore {
status: "connected" | "disconnected" | "connecting" | "error";
message: string;
selectedZone: string;
logoffTime: string;
connect: (
uid: string,
selectedZone: string,
@@ -17,6 +18,7 @@ export const useDispatchConnectionStore = create<ConnectionStore>((set) => ({
status: "disconnected",
message: "",
selectedZone: "LST_01",
logoffTime: "",
connect: async (uid, selectedZone, logoffTime) =>
new Promise((resolve) => {
set({ status: "connecting", message: "" });
@@ -58,3 +60,12 @@ dispatchSocket.on("force-disconnect", (reason: string) => {
message: reason,
});
});
dispatchSocket.on("reconnect", () => {
const { logoffTime, selectedZone } = useDispatchConnectionStore.getState();
dispatchSocket.emit("connect-dispatch", {
logoffTime,
selectedZone,
});
});