From bc647a9ebe14588d48d42ac067ec17a3b0baa460 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi Date: Sat, 22 Jun 2024 16:07:46 +0530 Subject: [PATCH] refactor code --- modules/room/context/Room.context.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/room/context/Room.context.tsx b/modules/room/context/Room.context.tsx index a55106d..96ed492 100644 --- a/modules/room/context/Room.context.tsx +++ b/modules/room/context/Room.context.tsx @@ -1,4 +1,5 @@ import { socket } from "@/common/lib/socket"; +import { useSetRoom, useSetUsers } from "@/common/recoil/room/room.hooks"; import usersAtom, { useUserIds } from "@/common/recoil/users"; import { MotionValue, useMotionValue } from "framer-motion"; import { createContext, ReactChild, useEffect } from "react"; @@ -13,8 +14,8 @@ export const roomContext = createContext<{ const RoomContextProvider = ({ children }: { children: ReactChild }) => { - const setUsers= useSetRecoilState(usersAtom); - const usersIds= useUserIds(); + const setRoom = useSetRoom(); + const {handleAddUser, handleRemoveUser} = useSetUsers(); const x = useMotionValue(0); const y = useMotionValue(0); @@ -44,4 +45,8 @@ const RoomContextProvider = ({ children }: { children: ReactChild }) => { ); }; -export default RoomContextProvider; \ No newline at end of file +export default RoomContextProvider; + +function useSetUser(): { handleAddUser: any; handleRemoveUser: any; } { + throw new Error("Function not implemented."); +}