Skip to content

Commit

Permalink
Fix: 등록 / 수정 페이지의 버튼 onClick 핸들러 함수 개선 및 zod 스키마 유효성 검증 로직 수정
Browse files Browse the repository at this point in the history
Fix: 등록 / 수정 페이지의 버튼 onClick 핸들러 함수 개선 및 zod 스키마 유효성 검증 로직 수정
  • Loading branch information
sscoderati authored Jan 9, 2024
2 parents 80e7bf4 + 6e3e096 commit f8ac1d6
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
10 changes: 8 additions & 2 deletions src/pages/profile/ProfileCompanyEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ const ProfileCompanyEdit = () => {
/>
<NormalButton
normalButtonType={"email-certify"}
onClick={() => handleVerifyEmail(companyInfoForm.getValues("companyEmail"))}
onClick={(event) => {
event.preventDefault();
handleVerifyEmail(companyInfoForm.getValues("companyEmail"));
}}
>
{"이메일 인증"}
</NormalButton>
Expand Down Expand Up @@ -193,7 +196,10 @@ const ProfileCompanyEdit = () => {
{...companyInfoForm.register("certCode")}
/>
<StyleVerificationEmailButton
onClick={() => handleVerifyCode(companyInfoForm.getValues("certCode"))}
onClick={(event) => {
event.preventDefault();
handleVerifyCode(companyInfoForm.getValues("certCode"));
}}
>
{"확인"}
</StyleVerificationEmailButton>
Expand Down
10 changes: 8 additions & 2 deletions src/pages/register/RegisterCompany.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ const RegisterCompany = () => {
/>
<NormalButton
normalButtonType={"email-certify"}
onClick={() => handleEmailCertification(companyInfoForm.getValues("companyEmail"))}
onClick={(event) => {
event.preventDefault();
handleEmailCertification(companyInfoForm.getValues("companyEmail"));
}}
>
{"이메일 인증"}
</NormalButton>
Expand Down Expand Up @@ -229,7 +232,10 @@ const RegisterCompany = () => {
{...companyInfoForm.register("certCode")}
/>
<StyleVerificationEmailButton
onClick={() => checkCodeValid(companyInfoForm.getValues("certCode"))}
onClick={(event) => {
event.preventDefault();
checkCodeValid(companyInfoForm.getValues("certCode"));
}}
>
{"확인"}
</StyleVerificationEmailButton>
Expand Down
5 changes: 4 additions & 1 deletion src/pages/register/RegisterUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ const RegisterUser = () => {
/>
<NormalButton
normalButtonType={"nickname-duplicate"}
onClick={() => doubleCheckNickName(userInfoForm.getValues("nickname"))}
onClick={(event) => {
event.preventDefault();
doubleCheckNickName(userInfoForm.getValues("nickname"));
}}
>
{"중복확인"}
</NormalButton>
Expand Down
2 changes: 1 addition & 1 deletion src/schemas/companyInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const CompanyInfoSchema = z.object({
.string()
.min(1, { message: "회사 이메일을 입력해주세요." })
.email({ message: "이메일 형식이어야 합니다." }),
department: z.array(z.string().min(1, { message: "부서를 선택해주세요." })),
department: z.array(z.string()).min(1, { message: "부서를 선택해주세요." }),
certCode: z.string().min(1, { message: "인증 코드를 입력해주세요." }),
businessCard: z
.any()
Expand Down
2 changes: 1 addition & 1 deletion src/schemas/userInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as z from "zod";

export const UserInfoSchema = z.object({
nickname: z.string().min(1, { message: "닉네임을 입력해주세요." }),
interest: z.array(z.string().min(1, { message: "관심사를 선택해주세요." })),
interest: z.array(z.string()).min(1, { message: "관심사를 선택해주세요." }),
});

export type UserInfoStateType = z.infer<typeof UserInfoSchema>;

0 comments on commit f8ac1d6

Please sign in to comment.