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;