added DME, fixed sync and bugs. Rewrote setDisplay logic
This commit is contained in:
@@ -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,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user