Skip to content

Commit

Permalink
fix: 회원가입 액션 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ChoiWonBeen authored Mar 4, 2024
1 parent d0ae860 commit fc031cf
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);
}

Check failure on line 85 in src/query/register.ts

View workflow job for this annotation

GitHub Actions / ESLint

Closing curly brace does not appear on the same line as the subsequent block
catch (e) {
showToast('error', "회원가입 중 에러가 발생했어요" + e);

Check failure on line 87 in src/query/register.ts

View workflow job for this annotation

GitHub Actions / ESLint

Strings must use singlequote

Check failure on line 87 in src/query/register.ts

View workflow job for this annotation

GitHub Actions / ESLint

Unexpected string concatenation
}
} catch (e) {
showToast('error', "파일업로드 중 에러가 발생했어요" + e);

Check failure on line 90 in src/query/register.ts

View workflow job for this annotation

GitHub Actions / ESLint

Strings must use singlequote

Check failure on line 90 in src/query/register.ts

View workflow job for this annotation

GitHub Actions / ESLint

Unexpected string concatenation
}
}

Check failure on line 92 in src/query/register.ts

View workflow job for this annotation

GitHub Actions / ESLint

Missing trailing comma
});

return fileMutation;
Expand Down

0 comments on commit fc031cf

Please sign in to comment.