Skip to content

Commit

Permalink
merge: Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
eonseok-jeon committed Jul 31, 2024
2 parents f394f19 + b724a95 commit d8fe548
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 5 additions & 2 deletions src/common/components/Input/components/InputTheme/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ export const TextBox이메일 = ({
});

const { checkVerificationCodeMutate, checkVerificationCodeIsPending } = useMutateCheckCode({
onChangeVerification,
onSetActive: () => setIsActive(false),
onSuccess: () => {
onChangeVerification(true);
setIsActive(false);
clearErrors('email');
},
});

const handleResetTimer = useCallback(() => {
Expand Down
10 changes: 3 additions & 7 deletions src/common/components/Input/hooks/useMutateCheckCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import type { ErrorResponse } from '@type/errorResponse';
import type { AxiosError, AxiosResponse } from 'axios';

interface MutateCheckCodeProps {
onChangeVerification: (bool: boolean) => void;
onSetActive: () => void;
onSuccess: () => void;
}

const useMutateCheckCode = ({ onChangeVerification, onSetActive }: MutateCheckCodeProps) => {
const useMutateCheckCode = ({ onSuccess }: MutateCheckCodeProps) => {
const { setError } = useFormContext();

const { mutate: checkVerificationCodeMutate, isPending: checkVerificationCodeIsPending } = useMutation<
Expand All @@ -23,10 +22,7 @@ const useMutateCheckCode = ({ onChangeVerification, onSetActive }: MutateCheckCo
CheckVerificationCodeRequest
>({
mutationFn: ({ email, code }: CheckVerificationCodeRequest) => checkVerificationCode(email, code),
onSuccess: () => {
onSetActive();
onChangeVerification(true);
},
onSuccess,
onError(error) {
if (error.response?.status === 400) {
setError('code', {
Expand Down

0 comments on commit d8fe548

Please sign in to comment.