Skip to content

Commit

Permalink
hotfix: 베포환경 로그인 문제
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-dong-su committed Apr 8, 2024
1 parent f3c4986 commit 830c80e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
12 changes: 7 additions & 5 deletions packages/web/src/apis/auth/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ export const useLoginMutation = () => {
return useMutation({
mutationFn: postLogin,
onSuccess: async (response: LoginResponse) => {
await login({
accessToken: response.token.accessToken,
refreshToken: response.token.refreshToken,
userId: response.userId,
});
if (response.existUser) {
await login({
accessToken: response.token.accessToken,
refreshToken: response.token.refreshToken,
userId: response.userId,
});
}
},
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { LayerLoading } from '@/components/Loading';
import { useTimerContext } from '@/components/Provider';
import { TextFieldController } from '@/components/TextField';
import { regexr } from '@/constants/regexr';
import useLogin from '@/hooks/token/useLogin';

interface NumberVerifyFormProps {
setInputStatus: React.Dispatch<React.SetStateAction<'beforeSend' | 'afterSend'>>;
Expand All @@ -23,11 +22,10 @@ export default function NumberVerifyForm({ setInputStatus }: NumberVerifyFormPro
const hookForm = useJoinContext();
const { handleSubmit, setError, register, watch, resetField } = hookForm;
const { time, reset, start } = useTimerContext();
const { login } = useLogin();

const { nextStep } = useFunnelContext();
const { mutate: mutateSMSVerify } = useSMSVerifyMutation();
const { mutate: mutateLogin, status } = useLoginMutation();
const { mutateAsync: mutateLogin, status } = useLoginMutation();
const { mutate: mutateSMS } = useSMSMutation();

const handleResend = () => {
Expand Down Expand Up @@ -62,8 +60,13 @@ export default function NumberVerifyForm({ setInputStatus }: NumberVerifyFormPro
code: '' + data.verifyNumber,
},
{
onSuccess: () => {
mutateLogin({ phoneNumber: data.phoneNumber });
onSuccess: async () => {
const response = await mutateLogin({ phoneNumber: data.phoneNumber });

if (!response.existUser) {
nextStep();
return;
}
},
onError: () => {
setError('verifyNumber', {
Expand Down

0 comments on commit 830c80e

Please sign in to comment.