diff --git a/common/recoil/room/room.atom.ts b/common/recoil/room/room.atom.ts index f3570a7..f378364 100644 --- a/common/recoil/room/room.atom.ts +++ b/common/recoil/room/room.atom.ts @@ -1,6 +1,6 @@ import { atom } from "recoil"; -export const roomAtom = atom({ +export const roomAtom = atom({ key: "room", default: { id: "", diff --git a/common/recoil/room/room.hooks.ts b/common/recoil/room/room.hooks.ts index 44f9005..cf545c0 100644 --- a/common/recoil/room/room.hooks.ts +++ b/common/recoil/room/room.hooks.ts @@ -11,7 +11,7 @@ export const useSetRoomId = () => { const setRoomId= useSetRecoilState(roomAtom); const handleSetRoomId = (id: string) => { - setRoomId({id}); + setRoomId((prev)=> ({...prev,id})); }; - return handleSetRoomId + return handleSetRoomId; }; \ No newline at end of file diff --git a/common/types/global.d.ts b/common/types/global.d.ts index f3ad383..3b09407 100644 --- a/common/types/global.d.ts +++ b/common/types/global.d.ts @@ -11,6 +11,13 @@ export declare global { type Room = {users: Map; drawed: Move[]}; + interface ClientRoom{ + id:string; + users: Map; + movesWithoutUser: Move[]; + myMoves: Move[]; + } + interface ServerToClientEvents { room: (room: Room, usersToParse: string)=> void; created: (roomId: string) => void;