From 42dd7eb8c17e765eb1031bac93f8e01297ed6912 Mon Sep 17 00:00:00 2001 From: eunhak Date: Wed, 12 Jun 2024 01:11:03 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=B7=A8=EC=86=8C=EB=90=9C=20=EC=95=8C?= =?UTF-8?q?=EB=A6=BC=20+=20=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=82=98=EA=B0=84?= =?UTF-8?q?=20=EC=95=8C=EB=A6=BC=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modal/MeetingDetailModal.tsx | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/components/reservation/myReservationList/modal/MeetingDetailModal.tsx b/src/components/reservation/myReservationList/modal/MeetingDetailModal.tsx index 60cdf2e..1c9fde4 100644 --- a/src/components/reservation/myReservationList/modal/MeetingDetailModal.tsx +++ b/src/components/reservation/myReservationList/modal/MeetingDetailModal.tsx @@ -1,16 +1,16 @@ 'use client'; import useOnClickOutside from '@/components/community/hooks/useOnClickOutside'; import { useReservationStore } from '@/store/reservationModal.store'; -import React, { useRef } from 'react'; +import React, { useEffect, useRef } from 'react'; import { useQuery } from 'react-query'; import { getReservationDetail } from '../../remote/myreservation'; import { format, isBefore, isSameDay, parseISO } from 'date-fns'; import { participantsType } from '../../model/myreservation'; import { ko } from 'date-fns/locale'; -// import { useRouter } from 'next/navigation'; +import { useRouter } from 'next/navigation'; const MeetingDetailModal = () => { - // const router = useRouter(); + const router = useRouter(); const { setOpen, reservationId, @@ -31,17 +31,20 @@ const MeetingDetailModal = () => { } ); - // console.log(data?.status); - // console.log(data); - // /* eslint-disable */ - // useEffect(() => { - // setLateDataTest(data?.data); - // console.log(LateDataTest); - // if (!LateDataTest) { - // alert('이미 종료된 일정입니다'); - // router.push('/'); - // } - // }, [data]); + console.log(data?.status); + console.log(data); + /* eslint-disable */ + useEffect(() => { + if (data?.reservationProgress === 'AFTER_USE') { + alert('이미 종료된 일정입니다'); + router.push('/'); + setOpen(false); + } else if (data?.reservationStatus === 'CANCELED') { + alert('취소된 일정입니다'); + router.push('/'); + setOpen(false); + } + }, [data]); if (data == undefined) { return null;