From aff87f9b3e571c734306d8e26e3ab7623b955a0c Mon Sep 17 00:00:00 2001 From: leeharyung Date: Thu, 4 Aug 2022 17:23:03 +0900 Subject: [PATCH] add axios request for room current num --- src/components/main/Block.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/main/Block.tsx b/src/components/main/Block.tsx index ed88e9a6..adfe119f 100644 --- a/src/components/main/Block.tsx +++ b/src/components/main/Block.tsx @@ -6,6 +6,7 @@ import blockInterface from '../../interface/block.interface'; import MyAvatar from '../../assets/avatar/MyAvatar'; import ThemeImage from '../atoms/ThemeImages'; import { ReactComponent as Bar } from '../../assets/svg/Room/Bar.svg'; +import useRoom from '../../hooks/useRoom'; export default function Block({ isMain, @@ -20,12 +21,20 @@ export default function Block({ }: blockInterface) { const navigate = useNavigate(); const { nickname } = UserStore(); + const { data } = useRoom(itemId); + const enterRoom = (event: React.MouseEvent) => { event.preventDefault(); if (!nickname) { alert('로그인이 필요합니다.'); return; } + + if (data.current === data.total) { + alert('방이 이미 초과되었습니다.'); + return; + } + navigate(`/ready/${itemId}`); }; return (