Skip to content

Commit

Permalink
refactor: 이벤트 핸들러 함수 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
chaeseungyun committed Apr 8, 2024
1 parent 0f08c71 commit fb28382
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/page/Reservation/view/Month/MonthModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ export default function MonthModal({
};
const changeReason = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => setReserve({ ...reserve, reason: e.target.value });
const changeDetailedReason = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => setReserve({ ...reserve, detailedReason: e.target.value });
const postReservation = () => {
if (today
&& reserve.memberCount >= 1
) {
reservation({
memberCount: reserve.memberCount,
reason: reserve.reason,
detailedReason: reserve.detailedReason,
startDateTime: `${today.slice(0, 4)}-${today.slice(5, 7)}-${today.slice(8, 10)} ${reserve.startHour}:${reserve.startMinute}`,
endDateTime: `${today.slice(0, 4)}-${today.slice(5, 7)}-${today.slice(8, 10)} ${reserve.endHour}:${reserve.endMinute}`,
});
if (!isError) handleClose();
}
};

return (
<Modal
Expand Down Expand Up @@ -194,20 +208,7 @@ export default function MonthModal({
</div>
<Button
variant="outlined"
onClick={() => {
if (today
&& reserve.memberCount >= 1
) {
reservation({
memberCount: reserve.memberCount,
reason: reserve.reason,
detailedReason: reserve.detailedReason,
startDateTime: `${today.slice(0, 4)}-${today.slice(5, 7)}-${today.slice(8, 10)} ${reserve.startHour}:${reserve.startMinute}`,
endDateTime: `${today.slice(0, 4)}-${today.slice(5, 7)}-${today.slice(8, 10)} ${reserve.endHour}:${reserve.endMinute}`,
});
if (!isError) handleClose();
}
}}
onClick={postReservation}
>
예약
</Button>
Expand Down

0 comments on commit fb28382

Please sign in to comment.