From 83ffe3117b6a931b259ff0c0576e00678d658c18 Mon Sep 17 00:00:00 2001 From: eunhak Date: Tue, 11 Jun 2024 20:13:05 +0900 Subject: [PATCH] fix: stash file --- .../MyReservationListIndex.tsx | 24 +++++++++++++- .../modal/MeetingDetailModal.tsx | 32 +++++++++---------- src/pages/notification/index.tsx | 2 +- 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/src/components/reservation/myReservationList/MyReservationListIndex.tsx b/src/components/reservation/myReservationList/MyReservationListIndex.tsx index 4e81bf9..fc3f536 100644 --- a/src/components/reservation/myReservationList/MyReservationListIndex.tsx +++ b/src/components/reservation/myReservationList/MyReservationListIndex.tsx @@ -1,5 +1,5 @@ 'use client'; -import React from 'react'; +import React, { useEffect } from 'react'; import MyReservationHeader from './MyReservationHeader'; import MyReservationNav from './MyReservationNav'; import TodayReservation from './TodayReservation'; @@ -8,10 +8,32 @@ import FRDetailModal from './modal/FRDetailModal'; import MeetingDetailModal from './modal/MeetingDetailModal'; import ReservationDeleteModal from './modal/ReservationDeleteModal'; import ExpectedReservationIndex from './expectedReservation/ExpectedReservationIndex'; +import { getReservationDetail } from '../remote/myreservation'; +import { useQuery } from 'react-query'; const MyReservationListIndex = () => { const { open, reservationId, isMeeting, deleteOpen, deleteDeskId } = useReservationStore(); + + const { data } = useQuery( + ['reservationDetail', reservationId], + async () => await getReservationDetail(reservationId), + { + enabled: reservationId != null + } + ); + + useEffect(() => { + console.log(data); + // if (!LateDataTest) { + // alert('이미 종료된 일정입니다'); + // router.push('/'); + // } + }, [data]); + + if (data == undefined) { + return null; + } return (
diff --git a/src/components/reservation/myReservationList/modal/MeetingDetailModal.tsx b/src/components/reservation/myReservationList/modal/MeetingDetailModal.tsx index de14d51..2b06a15 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, { useEffect, useRef, useState } from 'react'; +import React, { 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, @@ -22,7 +22,7 @@ const MeetingDetailModal = () => { const ref = useRef(null); useOnClickOutside(ref, () => setOpen(false)); - const [LateDataTest, setLateDataTest] = useState(''); + // const [LateDataTest, setLateDataTest] = useState(''); const { data } = useQuery( ['reservationDetail', reservationId], async () => await getReservationDetail(reservationId), @@ -33,19 +33,19 @@ const MeetingDetailModal = () => { // console.log(data?.status); // console.log(data); - /* eslint-disable */ - useEffect(() => { - setLateDataTest(data?.data); - console.log(LateDataTest); - if (!LateDataTest) { - alert('이미 종료된 일정입니다'); - router.push('/'); - } - }, [data]); + // /* eslint-disable */ + // useEffect(() => { + // setLateDataTest(data?.data); + // console.log(LateDataTest); + // if (!LateDataTest) { + // alert('이미 종료된 일정입니다'); + // router.push('/'); + // } + // }, [data]); - if (data == undefined) { - return null; - } + // if (data == undefined) { + // return null; + // } const date = data && data.startAt diff --git a/src/pages/notification/index.tsx b/src/pages/notification/index.tsx index 22403c5..4d10eb6 100644 --- a/src/pages/notification/index.tsx +++ b/src/pages/notification/index.tsx @@ -49,7 +49,7 @@ const Notification = () => { const { todayNotifications, pastNotifications } = categorizeNotifications( allPosts || [] ); - console.log(allPosts); + return (