Added Connection Component, Store, JWT logic

This commit is contained in:
PxlLoewe
2025-03-14 19:46:09 -07:00
parent d7e4ae468d
commit abf3475c7c
9 changed files with 65 additions and 21 deletions

View File

@@ -3,10 +3,15 @@ import { socket } from "../(dispatch)/socket";
console.log("connectionStore");
export const connectionStore = create((set) => ({
interface ConnectionStore {
isConnected: boolean;
connect: (uid: string) => Promise<void>;
}
export const connectionStore = create<ConnectionStore>((set) => ({
isConnected: false,
connect: async (jwt: string) => {
socket.auth = { token: "jwt" };
connect: async (uid: string) => {
socket.auth = { uid };
socket.connect();
},
}));