Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

경북대 FE_이효은 4주차 과제 Step3 #95

Open
wants to merge 25 commits into
base: hyoeunkh
Choose a base branch
from

Conversation

Hyoeunkh
Copy link

안녕하세요 멘토님,
step3,4 제출합니다. 감사합니다 :)

Copy link

@sjoleee sjoleee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다~! 리뷰 남깁니다.

</Route>
</Routes>
</AuthProvider>
<FormProvider {...methods}>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FormProvider가 필요 이상으로 상위에 위치하는 것은 아닐까요?

Comment on lines 23 to 49
const onSubmit = (value: FormValues) => {
if (value.message && value.message.length > 100) {
alert('메시지는 100자 이내로 입력해주세요.');
return;
}
if (!value.message) {
alert('메시지를 입력해주세요.');
return;
}
if (value.cashReceipt && !value.number) {
alert('현금영수증 번호를 입력해주세요');
return;
}
if (isNaN(Number(value.number))) {
alert('현금영수증 번호는 숫자로만 입력해주세요.');
return;
}
alert('주문이 완료되었습니다.');
};

const totalPrice = data.detail.price.basicPrice * orderHistory.count;

return (
<PaymentSectionWrapper>
<Title>결제 정보</Title>
<Divider color="#e6e6e6" />
<form onSubmit={handleSubmit(onSubmit)}>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handleSubmit의 첫번째 인자는 onValid로, 유효성 검사를 통과할 경우 호출되는 콜백입니다.
hook-form의 유효성 검사에 의존하지 않고 사용법과 다르게 유효성을 검사하는 이유가 있을까요??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants