Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"react": "^18",
"react-dom": "^18",
"react-hook-form": "^7.60.0",
"react-hot-toast": "^2.6.0",
"sockjs-client": "^1.6.1",
"tailwind-merge": "^3.0.2",
"tailwindcss-animate": "^1.0.7",
Expand Down
4 changes: 0 additions & 4 deletions apps/web/src/apis/Auth/deleteAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { AxiosError } from "axios";
import { useRouter } from "next/navigation";

import useAuthStore from "@/lib/zustand/useAuthStore";
import { toast } from "@/lib/zustand/useToastStore";
import { type AccountResponse, authApi } from "./api";

/**
Expand All @@ -26,9 +25,6 @@ const useDeleteUserAccount = () => {
clearAccessToken();
queryClient.clear();
},
onError: () => {
toast.error("회원탈퇴에 실패했습니다. 잠시 후 다시 시도해주세요.");
},
});
};

Expand Down
3 changes: 1 addition & 2 deletions apps/web/src/apis/Auth/postAppleAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useMutation } from "@tanstack/react-query";

import type { AxiosError } from "axios";
import { useRouter } from "next/navigation";
import { toast } from "react-hot-toast";
import useAuthStore from "@/lib/zustand/useAuthStore";
import { toast } from "@/lib/zustand/useToastStore";
import { type AppleAuthRequest, type AppleAuthResponse, authApi } from "./api";

/**
Expand Down Expand Up @@ -31,7 +31,6 @@ const usePostAppleAuth = () => {
}
},
onError: () => {
toast.error("애플 로그인 중 오류가 발생했습니다. 다시 시도해주세요.");
router.push("/login");
},
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/apis/Auth/postEmailLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useMutation } from "@tanstack/react-query";

import type { AxiosError } from "axios";
import { useRouter } from "next/navigation";
import { toast } from "react-hot-toast";
import useAuthStore from "@/lib/zustand/useAuthStore";
import { toast } from "@/lib/zustand/useToastStore";
import { authApi, type EmailLoginRequest, type EmailLoginResponse } from "./api";

/**
Expand Down
4 changes: 0 additions & 4 deletions apps/web/src/apis/Auth/postEmailVerification.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useMutation } from "@tanstack/react-query";
import type { AxiosError } from "axios";

import { toast } from "@/lib/zustand/useToastStore";
import { authApi, type EmailSignUpRequest, type EmailSignUpResponse } from "./api";

/**
Expand All @@ -10,9 +9,6 @@ import { authApi, type EmailSignUpRequest, type EmailSignUpResponse } from "./ap
const usePostEmailSignUp = () => {
return useMutation<EmailSignUpResponse, AxiosError, EmailSignUpRequest>({
mutationFn: (data) => authApi.postEmailSignUp(data),
onError: (error) => {
toast.error("회원가입에 실패했습니다.");
},
});
};

Expand Down
3 changes: 1 addition & 2 deletions apps/web/src/apis/Auth/postKakaoAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useMutation } from "@tanstack/react-query";

import type { AxiosError } from "axios";
import { useRouter } from "next/navigation";
import { toast } from "react-hot-toast";
import useAuthStore from "@/lib/zustand/useAuthStore";
import { toast } from "@/lib/zustand/useToastStore";
import { authApi, type KakaoAuthRequest, type KakaoAuthResponse } from "./api";

/**
Expand Down Expand Up @@ -31,7 +31,6 @@ const usePostKakaoAuth = () => {
}
},
onError: () => {
toast.error("카카오 로그인 중 오류가 발생했습니다. 다시 시도해주세요.");
router.push("/login");
},
});
Expand Down
4 changes: 0 additions & 4 deletions apps/web/src/apis/Auth/postSignUp.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useMutation } from "@tanstack/react-query";
import type { AxiosError } from "axios";

import { toast } from "@/lib/zustand/useToastStore";
import { authApi, type SignUpRequest, type SignUpResponse } from "./api";

/**
Expand All @@ -10,9 +9,6 @@ import { authApi, type SignUpRequest, type SignUpResponse } from "./api";
const usePostSignUp = () => {
return useMutation<SignUpResponse, AxiosError, SignUpRequest>({
mutationFn: (data) => authApi.postSignUp(data),
onError: (error) => {
toast.error("회원가입에 실패했습니다.");
},
});
};

Expand Down
6 changes: 1 addition & 5 deletions apps/web/src/apis/MyPage/patchPassword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";

import type { AxiosError } from "axios";
import { useRouter } from "next/navigation";
import { toast } from "react-hot-toast";
import useAuthStore from "@/lib/zustand/useAuthStore";
import { toast } from "@/lib/zustand/useToastStore";
import { QueryKeys } from "../queryKeys";
import { myPageApi, type PasswordPatchRequest } from "./api";

Expand All @@ -21,10 +21,6 @@ const usePatchMyPassword = () => {
toast.success("비밀번호가 성공적으로 변경되었습니다.");
router.replace("/");
},
onError: (error) => {
const errorMessage = error.response?.data?.message;
toast.error(errorMessage || "비밀번호 변경에 실패했습니다. 다시 시도해주세요.");
},
});
};

Expand Down
6 changes: 1 addition & 5 deletions apps/web/src/apis/MyPage/patchProfile.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import type { AxiosError } from "axios";
import { toast } from "@/lib/zustand/useToastStore";
import { toast } from "react-hot-toast";
import { QueryKeys } from "../queryKeys";
import { myPageApi, type ProfilePatchRequest } from "./api";

Expand All @@ -18,10 +18,6 @@ const usePatchMyInfo = () => {
onSuccess: () => {
toast.success("프로필이 성공적으로 수정되었습니다.");
},
onError: (error) => {
const errorMessage = error.response?.data?.message;
toast.error(errorMessage || "프로필 수정에 실패했습니다. 다시 시도해주세요.");
},
});
};

Expand Down
6 changes: 1 addition & 5 deletions apps/web/src/apis/Scores/postCreateGpa.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";

import { toast } from "@/lib/zustand/useToastStore";
import { toast } from "react-hot-toast";
import { ScoresQueryKeys, scoresApi, type UsePostGpaScoreRequest } from "./api";

/**
Expand All @@ -16,10 +16,6 @@ export const usePostGpaScore = () => {
toast.success("학점 정보가 성공적으로 제출되었습니다.");
queryClient.invalidateQueries({ queryKey: [ScoresQueryKeys.myGpaScore] });
},

onError: (error) => {
toast.error("오류가 발생했습니다. 다시 시도해주세요.");
},
});
};

Expand Down
6 changes: 1 addition & 5 deletions apps/web/src/apis/Scores/postCreateLanguageTest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";

import { toast } from "@/lib/zustand/useToastStore";
import { toast } from "react-hot-toast";
import { ScoresQueryKeys, scoresApi, type UsePostLanguageTestScoreRequest } from "./api";

/**
Expand All @@ -16,10 +16,6 @@ export const usePostLanguageTestScore = () => {
toast.success("어학 성적이 성공적으로 제출되었습니다.");
queryClient.invalidateQueries({ queryKey: [ScoresQueryKeys.myLanguageTestScore] });
},

onError: (error) => {
toast.error("오류가 발생했습니다. 다시 시도해주세요.");
},
});
};

Expand Down
5 changes: 0 additions & 5 deletions apps/web/src/apis/applications/postSubmitApplication.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { type UseMutationOptions, type UseMutationResult, useMutation } from "@tanstack/react-query";
import type { AxiosError, AxiosResponse } from "axios";

import { toast } from "@/lib/zustand/useToastStore";
import { applicationsApi, type UseSubmitApplicationRequest, type UseSubmitApplicationResponse } from "./api";

/**
Expand All @@ -27,10 +26,6 @@ const usePostSubmitApplication = (
>({
...props,
mutationFn: applicationsApi.postSubmitApplication,
onError: (error) => {
const errorMessage = error?.response?.data?.message;
toast.error(errorMessage || "지원 중 오류가 발생했습니다. 다시 시도해주세요.");
},
});
};

Expand Down
5 changes: 1 addition & 4 deletions apps/web/src/apis/community/deleteComment.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import type { AxiosError } from "axios";

import { toast } from "@/lib/zustand/useToastStore";
import { toast } from "react-hot-toast";
import { type CommentIdResponse, CommunityQueryKeys, communityApi } from "./api";

interface DeleteCommentRequest {
Expand All @@ -22,9 +22,6 @@ const useDeleteComment = () => {
queryClient.invalidateQueries({ queryKey: [CommunityQueryKeys.posts, variables.postId] });
toast.success("댓글이 삭제되었습니다.");
},
onError: (error) => {
toast.error("댓글 삭제에 실패했습니다.");
},
});
};

Expand Down
4 changes: 0 additions & 4 deletions apps/web/src/apis/community/deleteLikePost.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import type { AxiosError } from "axios";

import { toast } from "@/lib/zustand/useToastStore";
import { CommunityQueryKeys, communityApi, type PostLikeResponse } from "./api";

/**
Expand All @@ -16,9 +15,6 @@ const useDeleteLike = () => {
// 해당 게시글 상세 쿼리를 무효화하여 최신 데이터 반영
queryClient.invalidateQueries({ queryKey: [CommunityQueryKeys.posts, postId] });
},
onError: (error) => {
toast.error("좋아요 취소 처리에 실패했습니다.");
},
});
};

Expand Down
6 changes: 1 addition & 5 deletions apps/web/src/apis/community/deletePost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";

import type { AxiosError, AxiosResponse } from "axios";
import { useRouter } from "next/navigation";

import { toast } from "react-hot-toast";
import useAuthStore from "@/lib/zustand/useAuthStore";
import { toast } from "@/lib/zustand/useToastStore";
import { CommunityQueryKeys, communityApi, type DeletePostResponse } from "./api";

interface DeletePostVariables {
Expand Down Expand Up @@ -59,9 +58,6 @@ const useDeletePost = () => {
// 게시글 목록 페이지 이동
router.replace(`/community/${variables.boardCode || "FREE"}`);
},
onError: (error) => {
toast.error("게시글 삭제에 실패했습니다. 잠시 후 다시 시도해주세요.");
},
});
};

Expand Down
6 changes: 1 addition & 5 deletions apps/web/src/apis/community/patchUpdatePost.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import type { AxiosError } from "axios";

import { toast } from "react-hot-toast";
import useAuthStore from "@/lib/zustand/useAuthStore";
import { toast } from "@/lib/zustand/useToastStore";
import { CommunityQueryKeys, communityApi, type PostIdResponse, type PostUpdateRequest } from "./api";

interface UpdatePostVariables {
Expand Down Expand Up @@ -54,9 +53,6 @@ const useUpdatePost = () => {

toast.success("게시글이 수정되었습니다.");
},
onError: (error) => {
toast.error("게시글 수정에 실패했습니다.");
},
});
};

Expand Down
5 changes: 1 addition & 4 deletions apps/web/src/apis/community/postCreateComment.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import type { AxiosError } from "axios";

import { toast } from "@/lib/zustand/useToastStore";
import { toast } from "react-hot-toast";
import { type CommentCreateRequest, type CommentIdResponse, CommunityQueryKeys, communityApi } from "./api";

/**
Expand All @@ -17,9 +17,6 @@ const useCreateComment = () => {
queryClient.invalidateQueries({ queryKey: [CommunityQueryKeys.posts, variables.postId] });
toast.success("댓글이 등록되었습니다.");
},
onError: (error) => {
toast.error("댓글 등록에 실패했습니다.");
},
});
};

Expand Down
6 changes: 1 addition & 5 deletions apps/web/src/apis/community/postCreatePost.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import type { AxiosError } from "axios";

import { toast } from "react-hot-toast";
import useAuthStore from "@/lib/zustand/useAuthStore";
import { toast } from "@/lib/zustand/useToastStore";
import { CommunityQueryKeys, communityApi, type PostCreateRequest, type PostIdResponse } from "./api";

/**
Expand Down Expand Up @@ -47,9 +46,6 @@ const useCreatePost = () => {

toast.success("게시글이 등록되었습니다.");
},
onError: (error) => {
toast.error("게시글 등록에 실패했습니다.");
},
});
};

Expand Down
4 changes: 0 additions & 4 deletions apps/web/src/apis/community/postLikePost.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import type { AxiosError } from "axios";

import { toast } from "@/lib/zustand/useToastStore";
import { CommunityQueryKeys, communityApi, type PostLikeResponse } from "./api";

/**
Expand All @@ -16,9 +15,6 @@ const usePostLike = () => {
// 해당 게시글 상세 쿼리를 무효화하여 최신 데이터 반영
queryClient.invalidateQueries({ queryKey: [CommunityQueryKeys.posts, postId] });
},
onError: (error) => {
toast.error("좋아요 처리에 실패했습니다.");
},
});
};

Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/apis/image-upload/postUploadProfileImage.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { useMutation } from "@tanstack/react-query";
import type { AxiosError } from "axios";
import { SKIP_GLOBAL_ERROR_TOAST_META } from "@/lib/react-query/errorToastMeta";
import { imageUploadApi, type UploadProfileImageResponse } from "./api";

const usePostUploadProfileImage = () => {
return useMutation<UploadProfileImageResponse, AxiosError, File>({
mutationFn: (file) => imageUploadApi.postUploadProfileImage(file),
meta: SKIP_GLOBAL_ERROR_TOAST_META,
});
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useMutation } from "@tanstack/react-query";
import type { AxiosError } from "axios";
import { toast } from "@/lib/zustand/useToastStore";
import type { FileResponse } from "@/types/file";
import { imageUploadApi } from "./api";

Expand All @@ -10,9 +9,6 @@ import { imageUploadApi } from "./api";
const useUploadProfileImagePublic = () => {
return useMutation<FileResponse, AxiosError, File>({
mutationFn: imageUploadApi.postUploadProfileImageBeforeSignup,
onError: (error) => {
toast.error("이미지 업로드에 실패했습니다.");
},
});
};

Expand Down
4 changes: 0 additions & 4 deletions apps/web/src/apis/mentor/postApplyMentoring.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import type { AxiosError } from "axios";

import { toast } from "@/lib/zustand/useToastStore";
import { MentorQueryKeys, mentorApi, type PostApplyMentoringRequest, type PostApplyMentoringResponse } from "./api";

/**
Expand All @@ -15,9 +14,6 @@ const usePostApplyMentoring = () => {
// 멘토링 신청 후 멘토 목록을 새로고침
await queryClient.invalidateQueries({ queryKey: [MentorQueryKeys.applyMentoringList] });
},
onError: () => {
toast.error("멘토 신청에 실패했습니다. 다시 시도해주세요.");
},
});
};

Expand Down
Loading
Loading