Skip to content

Commit

Permalink
Merge pull request #7 from 4bujak-4bujak/feature/verificationError
Browse files Browse the repository at this point in the history
fix: 인증코드 type number -> string 변경
  • Loading branch information
eun-hak authored May 16, 2024
2 parents 21d3443 + 05563e2 commit 124505a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/api/types/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface IPhoneNumber {
}

export interface IPhoneAuth extends IPhoneNumber {
code: number;
code: string;
}

export interface IUserInfo {
Expand All @@ -43,12 +43,12 @@ export interface IEmail {
emailAddress: string;
}
export interface IEmailAuth extends IEmail {
code: number;
code: string;
}

export interface IEmailAuth2 {
emailAddress: string;
code: number;
code: string;
}

export interface IToken {
Expand Down
4 changes: 2 additions & 2 deletions src/components/findpassword/EmailCertification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const EmailCertification = ({ setStep }: EmailCertificationProps) => {
});

const { mutateAsync: emailVerify } = useMutation(
({ emailAddress, code }: { emailAddress: string; code: number }) => {
({ emailAddress, code }: { emailAddress: string; code: string }) => {
return emailauthverify({ emailAddress, code });
}
);
Expand Down Expand Up @@ -117,7 +117,7 @@ const EmailCertification = ({ setStep }: EmailCertificationProps) => {
try {
const { status } = (await emailVerify({
emailAddress: userEmail,
code: Number(validNumber)
code: validNumber
})) as { status: string };

if (status == 'SUCCESS') {
Expand Down
4 changes: 2 additions & 2 deletions src/components/signup/EmailVerification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const EmailVerification = ({ onNext }: EmailVerification) => {
});

const { mutateAsync: emailVerify } = useMutation(
({ emailAddress, code }: { emailAddress: string; code: number }) => {
({ emailAddress, code }: { emailAddress: string; code: string }) => {
return emailauthverify({ emailAddress, code });
}
);
Expand Down Expand Up @@ -80,7 +80,7 @@ const EmailVerification = ({ onNext }: EmailVerification) => {
try {
const { status } = (await emailVerify({
emailAddress: userEmail,
code: Number(validNumber)
code: validNumber
})) as { status: string };

if (status == 'SUCCESS') {
Expand Down
9 changes: 7 additions & 2 deletions src/components/signup/PhoneCertification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const PhoneCertification = ({ onNext }: PhoneCertificationProps) => {
});

const { mutateAsync: phoneVerify } = useMutation(
({ phoneNumber, code }: { phoneNumber: string; code: number }) => {
({ phoneNumber, code }: { phoneNumber: string; code:string }) => {
return phoneauthverify({ phoneNumber, code });
}
);
Expand Down Expand Up @@ -114,6 +114,8 @@ const PhoneCertification = ({ onNext }: PhoneCertificationProps) => {

if (btnStatus == 'THIRD') {
if (validNumber.length != 6) {
console.log(validNumber)

setValidNumber('');
setErrorMessage('6자리 코드를 입력해주세요.');
inputRef.current?.focus();
Expand All @@ -122,7 +124,7 @@ const PhoneCertification = ({ onNext }: PhoneCertificationProps) => {
try {
const { status } = await phoneVerify({
phoneNumber: phoneNumber.replace(/-/g, ''),
code: Number(validNumber)
code: validNumber
});

if (status == 'SUCCESS') {
Expand All @@ -134,6 +136,9 @@ const PhoneCertification = ({ onNext }: PhoneCertificationProps) => {
const select = signError.find((item) => item.errorCode === errorCode);
if (select) {
setErrorMessage(select.message);
console.log(validNumber);
console.log(parseInt(validNumber, 10));
console.log(Number(validNumber));
setValidNumber('');
inputRef.current?.focus();
return;
Expand Down

0 comments on commit 124505a

Please sign in to comment.