Files
var-monorepo/apps/dispatch/app/_store/connectionStore.ts
2025-03-14 00:18:06 -07:00

17 lines
368 B
TypeScript

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 });
});