From 2125367bfc5a5ded3b13050f20902f2c5eebe982 Mon Sep 17 00:00:00 2001 From: G-hoon Date: Tue, 21 Jan 2025 23:26:16 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=AA=A8=EB=93=A0=20=ED=81=AC=EB=A3=A8?= =?UTF-8?q?=20=EC=9D=91=EC=9B=90=ED=95=98=EA=B8=B0=20=ED=95=98=EB=A0=A4?= =?UTF-8?q?=EA=B3=A0=20=ED=95=A0=20=EB=95=8C,=20=EC=9D=B4=EB=AF=B8=20?= =?UTF-8?q?=EC=A0=91=EC=86=8D=ED=95=9C=20=EB=AA=A8=EB=93=A0=20=ED=81=AC?= =?UTF-8?q?=EB=A3=A8=EB=A5=BC=20=EC=9D=91=EC=9B=90=ED=95=9C=20=EC=83=81?= =?UTF-8?q?=ED=83=9C=EB=9D=BC=EB=A9=B4=20=EC=A0=84=EC=86=A1=EC=9D=B4=20?= =?UTF-8?q?=EC=95=88=EB=90=98=EB=8F=84=EB=A1=9D=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Posture/PostrueCrew.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/components/Posture/PostrueCrew.tsx b/src/components/Posture/PostrueCrew.tsx index d04180e..4c5df01 100644 --- a/src/components/Posture/PostrueCrew.tsx +++ b/src/components/Posture/PostrueCrew.tsx @@ -223,18 +223,33 @@ export default function PostrueCrew(props: PostureCrewProps): ReactElement { }) } - const onClickAllCrewCheer = () => { + const onClickAllCrewCheer = async () => { const allCrewUids = crews.map((item) => item.uid) if (!allCrewUids || allCrewUids.length === 0) { toast.error("접속한 크루가 없습니다.") return } + const today = dayjs().format("YYYY-MM-DD") + try { + const { data } = await getMyCheerUpInfo(today) + const sortedCheeredUpUids = data.cheeredUpUids.sort() + const sortedCrewUids = allCrewUids.sort() + if ( + sortedCheeredUpUids.length === sortedCrewUids.length && + sortedCheeredUpUids.every((value, index) => value === sortedCrewUids[index]) + ) { + toast.error("현재 접속한 모든 크루에게 응원하기를 보냈습니다.") + return + } + } catch (error) { + console.log("error: ", error) + } + requestSendCrewCheer({ uids: allCrewUids, }).then(({ data }) => { if (data) { toast.success("모든 크루에게 응원하기 전송이 성공했습니다") - const today = dayjs().format("YYYY-MM-DD") getMyCheerUpInfo(today).then(({ data }) => { setCheeredUpCrewList(data.cheeredUpUids) setMyCheerCount(data.countCheeredUp)