Skip to content

Commit

Permalink
feat: 전화번호 에러 수정 (#1482)
Browse files Browse the repository at this point in the history
  • Loading branch information
seojisoosoo authored Jul 24, 2024
1 parent 3f71cb5 commit a9a3e92
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/auth/register/verify/useByPhone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const useByPhone = ({
if (!PHONE_REGEX.test(phone) && !PHONE_REGEX_SHORT.test(phone)) {
setState({
type: 'phoneError',
message: "'-'를 넣어 휴대폰 번호 양식에 맞게 입력해주세요.",
message: "잘못된 전화번호 형식입니다. '-'을 제외한 11자의 번호를 입력해주세요.",
});

return;
Expand Down
2 changes: 1 addition & 1 deletion src/components/auth/reset/useResetLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const useResetLogin = ({
if (!PHONE_REGEX.test(phone) && !PHONE_REGEX_SHORT.test(phone)) {
setState({
type: 'phoneError',
message: "'-'를 넣어 휴대폰 번호 양식에 맞게 입력해주세요.",
message: "잘못된 전화번호 형식입니다. '-'을 제외한 11자의 번호를 입력해주세요.",
});

return;
Expand Down
9 changes: 8 additions & 1 deletion src/components/members/upload/schema.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PHONE_REGEX_SHORT } from '@/components/auth/register/verify/regex';
import * as yup from 'yup';

const PHONE_REG_EXP = /^01([0|1|5|6|7|8|9])-([0-9]{3,4})-([0-9]{4})$/;
Expand Down Expand Up @@ -35,7 +36,13 @@ export const memberFormSchema = yup.object().shape({
),
})
.nullable(),
phone: yup.lazy(() => yup.string().nullable().required('연락처를 입력해주세요.')),
phone: yup.lazy(() =>
yup
.string()
.nullable()
.required('연락처를 입력해주세요.')
.matches(PHONE_REGEX_SHORT, "잘못된 전화번호 형식입니다. '-'을 제외한 11자의 번호를 입력해주세요."),
),
email: yup.lazy((value) =>
value === ''
? yup.string().required('이메일을 입력해주세요.')
Expand Down

0 comments on commit a9a3e92

Please sign in to comment.