Skip to content

Commit

Permalink
Merge commit 'fc031cf8c2da8032c0ef77e4cf08e49a8b982e5f' into feature/#…
Browse files Browse the repository at this point in the history
  • Loading branch information
(hoooooony) committed Mar 4, 2024
2 parents 484bba4 + fc031cf commit cf2a17a
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/query/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import parseRegisterData from 'page/Auth/Signup/utils/parseRegisterData';
import useRegisterInfo from 'store/registerStore';
import useShopRegistrationStore from 'store/shopRegistration';
import useUploadToken from 'store/uploadToken';
import showToast from 'utils/ts/showToast';

export const useCheckDuplicate = (email:string) => {
const { status, refetch, error } = useQuery({
Expand Down Expand Up @@ -62,11 +63,6 @@ export const useRegisterUser = (goNext:()=>void) => {
goNext();
resetRegisterInfo();
},
onError: () => {
alert('회원가입 중 에러가 발생했습니다. 처음부터 다시 진행해주세요');
resetRegisterInfo();
window.location.reload();
},
});
return { register };
};
Expand All @@ -81,16 +77,19 @@ export const useGetFileUrls = (goNext:()=>void) => {
});
const fileMutation = useMutation({
mutationKey: ['getFileUrls'],
mutationFn: () => getFileUrls(formData, uploadToken!),
onSuccess: (data) => {
register.mutate(data.file_urls);
},
onError: () => {
alert('파일 업로드 중 에러가 발생했습니다. 처음부터 다시 진행해주세요');
resetRegisterInfo();
window.location.reload();
},

mutationFn: async () => {
try {
const data = await getFileUrls(formData, uploadToken!);
try {
await register.mutateAsync(data.file_urls);
}
catch (e) {
showToast('error', "회원가입 중 에러가 발생했어요" + e);
}
} catch (e) {
showToast('error', "파일업로드 중 에러가 발생했어요" + e);
}
}
});

return fileMutation;
Expand Down

0 comments on commit cf2a17a

Please sign in to comment.