continue dispatch-server

This commit is contained in:
PxlLoewe
2025-03-14 00:18:06 -07:00
parent ec335ce489
commit 05b7d0fd39
14 changed files with 179 additions and 22 deletions

View File

@@ -0,0 +1,16 @@
import { create } from "zustand";
import { socket } from "../(dispatch)/socket";
console.log("connectionStore");
export const connectionStore = create((set) => ({
isConnected: false,
connect: async (jwt: string) => {
socket.auth = { token: "jwt" };
socket.connect();
},
}));
socket.on("connect", () => {
connectionStore.setState({ isConnected: true });
});

View File

@@ -0,0 +1,9 @@
import { create } from "zustand";
import { socket } from "../(dispatch)/socket";
export const stationStore = create((set) => {
return {
stations: [],
setStations: (stations: any) => set({ stations }),
};
});