From 149f9986994b7e851334e8f818fff0fae6068691 Mon Sep 17 00:00:00 2001 From: qhahd78 Date: Mon, 3 Jan 2022 00:32:05 +0900 Subject: [PATCH] =?UTF-8?q?[Fix]::Reservation=20=EC=98=88=EC=99=B8?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20=EC=99=84=EB=A3=8C=20close=20#63?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Components/MyReservation/Contents.jsx | 20 +++++++++++++++++ src/Layouts/MyReservation/MyReservation.jsx | 24 ++++++++++++--------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/Components/MyReservation/Contents.jsx b/src/Components/MyReservation/Contents.jsx index 1e7307d..51b9271 100644 --- a/src/Components/MyReservation/Contents.jsx +++ b/src/Components/MyReservation/Contents.jsx @@ -65,6 +65,16 @@ const CancelBtn = styled.button` } `; +const NoneDiv = styled.div` + display: flex; + align-items: center; + justify-content: center; + text-align: center; + height: 70vh; + font-size: 1.8rem; + font-weight: 700; +`; + const Contents = ({ remainTime, order, resName, peopleNum }) => { const history = useNavigate(); // 줄서기 취소이벤트 @@ -74,6 +84,16 @@ const Contents = ({ remainTime, order, resName, peopleNum }) => { history.push('/district1'); } }; + + if (!resName) { + return ( + + +

예약 정보가 없습니다.

+
+
+ ); + } return ( diff --git a/src/Layouts/MyReservation/MyReservation.jsx b/src/Layouts/MyReservation/MyReservation.jsx index 4d5d4fa..02e732d 100644 --- a/src/Layouts/MyReservation/MyReservation.jsx +++ b/src/Layouts/MyReservation/MyReservation.jsx @@ -15,25 +15,29 @@ const MyReservation = () => { try { // user의 waiting pk 로 waiting 정보 조회 및 저장 const waitingInfo = (await userWaiting(user.username)).data; - setWaitingInfo(waitingInfo); - setWaitingNum(waitingInfo.members.length); + console.log(waitingInfo); + if (waitingInfo.data.success) { + setWaitingInfo(waitingInfo); + setWaitingNum(waitingInfo.members.length); + } else { + setWaitingInfo({}); + } } catch (error) { return error; } }; + useEffect(() => { fetch(); }, []); return ( - <> - - + ); };