Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
[Fix]::Reservation 예외처리 완료 close #63
Browse files Browse the repository at this point in the history
  • Loading branch information
qhahd78 committed Jan 2, 2022
1 parent cafb3cf commit 149f998
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
20 changes: 20 additions & 0 deletions src/Components/MyReservation/Contents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
// 줄서기 취소이벤트
Expand All @@ -74,6 +84,16 @@ const Contents = ({ remainTime, order, resName, peopleNum }) => {
history.push('/district1');
}
};

if (!resName) {
return (
<Wrapper>
<NoneDiv>
<p>예약 정보가 없습니다.</p>
</NoneDiv>
</Wrapper>
);
}
return (
<Wrapper>
<Container>
Expand Down
24 changes: 14 additions & 10 deletions src/Layouts/MyReservation/MyReservation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
<Contents
remainTime={WaitingInfo.left_time}
order={WaitingInfo.order}
resName={WaitingInfo.restaurant}
peopleNum={WaitingNum}
/>
</>
<Contents
remainTime={WaitingInfo.left_time}
order={WaitingInfo.order}
resName={WaitingInfo.restaurant}
peopleNum={WaitingNum}
/>
);
};

Expand Down

0 comments on commit 149f998

Please sign in to comment.