File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { useMutation , useQueryClient } from '@tanstack/react-query' ;
22import { useRouter } from 'next/navigation' ;
3- import { DELETE } from '@/apis/services/httpMethod' ;
4- import { WithdrawalResponse } from '@/types/response ' ;
3+
4+ import { API } from '@/apis/services/httpMethod ' ;
55import { API_ENDPOINTS } from '@/constants/ApiEndpoints' ;
66import { notify } from '@/store/useToastStore' ;
7+ import { WithdrawalResponse } from '@/types/response' ;
78
89export const useWithdrawal = ( ) => {
910 const queryClient = useQueryClient ( ) ;
1011 const router = useRouter ( ) ;
1112
1213 return useMutation ( {
13- mutationFn : ( ) => DELETE < WithdrawalResponse > ( API_ENDPOINTS . AUTH . WITHDRAWAL ) ,
14+ mutationFn : ( ) =>
15+ API . delete < WithdrawalResponse > ( API_ENDPOINTS . AUTH . WITHDRAWAL ) ,
1416 onSuccess : ( ) => {
1517 notify ( 'success' , '회원탈퇴에 성공하였습니다.' , 3000 ) ;
1618 document . cookie = 'token=; max-age=0; path=/;' ;
Original file line number Diff line number Diff line change 11import { useMutation , useQueryClient } from '@tanstack/react-query' ;
2- import { notify } from '@/store/useToastStore' ;
3- import { DELETE } from '@/apis/services/httpMethod' ;
2+
3+ import { API } from '@/apis/services/httpMethod' ;
44import { API_ENDPOINTS } from '@/constants/ApiEndpoints' ;
5- import { QUERY_KEYS } from '@/constants/QueryKeys' ;
65import { TOAST_MESSAGES } from '@/constants/Messages' ;
6+ import { QUERY_KEYS } from '@/constants/QueryKeys' ;
7+ import { notify } from '@/store/useToastStore' ;
78import { CommentResponse } from '@/types/Comment' ;
89
910export const useDeleteComment = ( ) => {
1011 const queryClient = useQueryClient ( ) ;
1112
1213 return useMutation ( {
1314 mutationFn : ( commentId : number ) =>
14- DELETE < CommentResponse > ( API_ENDPOINTS . COMMENT . DELETE ( commentId ) ) ,
15+ API . delete < CommentResponse > ( API_ENDPOINTS . COMMENT . DELETE ( commentId ) ) ,
1516 onSuccess : ( ) => {
1617 queryClient . invalidateQueries ( { queryKey : [ QUERY_KEYS . COMPLETE_DETAIL ] } ) ;
1718 notify ( 'success' , TOAST_MESSAGES . COMMENT_DELETE_SUCCESS , 3000 ) ;
Original file line number Diff line number Diff line change 11import { useMutation , useQueryClient } from '@tanstack/react-query' ;
2- import { DELETE } from '@/apis/services/httpMethod' ;
2+
3+ import { API } from '@/apis/services/httpMethod' ;
34import { API_ENDPOINTS } from '@/constants/ApiEndpoints' ;
4- import { DeleteFollowResponse , UserProfileResponse } from '@/types/response' ;
5- import { notify } from '@/store/useToastStore' ;
65import { QUERY_KEYS } from '@/constants/QueryKeys' ;
6+ import { notify } from '@/store/useToastStore' ;
7+ import { DeleteFollowResponse , UserProfileResponse } from '@/types/response' ;
78
89export const useDeleteFollowMutation = ( ) => {
910 const queryClient = useQueryClient ( ) ;
1011
1112 return useMutation ( {
1213 mutationFn : ( userId : number ) =>
13- DELETE < DeleteFollowResponse > ( API_ENDPOINTS . FOLLOW . DELETE_FOLLOW ( userId ) ) ,
14+ API . delete < DeleteFollowResponse > (
15+ API_ENDPOINTS . FOLLOW . DELETE_FOLLOW ( userId ) ,
16+ ) ,
1417 onMutate : async ( userId ) => {
1518 const previousData = queryClient . getQueriesData < UserProfileResponse > ( {
1619 queryKey : [ QUERY_KEYS . USER_PROFILE , userId ] ,
Original file line number Diff line number Diff line change 11import { useMutation , useQueryClient } from '@tanstack/react-query' ;
2- import { notify } from '@/store/useToastStore' ;
3- import { DeleteFollowsResponse } from '@/types/Follows' ;
4- import { DELETE } from '@/apis/services/httpMethod' ;
2+
3+ import { API } from '@/apis/services/httpMethod' ;
54import { API_ENDPOINTS } from '@/constants/ApiEndpoints' ;
6- import { QUERY_KEYS } from '@/constants/QueryKeys' ;
75import { TOAST_MESSAGES } from '@/constants/Messages' ;
6+ import { QUERY_KEYS } from '@/constants/QueryKeys' ;
7+ import { notify } from '@/store/useToastStore' ;
8+ import { DeleteFollowsResponse } from '@/types/Follows' ;
89
910export const useDeleteFollow = ( ) => {
1011 const queryClient = useQueryClient ( ) ;
1112
1213 return useMutation ( {
1314 mutationFn : ( followerId : number ) =>
14- DELETE < DeleteFollowsResponse > ( API_ENDPOINTS . FOLLOW . DELETE ( followerId ) ) ,
15+ API . delete < DeleteFollowsResponse > (
16+ API_ENDPOINTS . FOLLOW . DELETE ( followerId ) ,
17+ ) ,
1518 onSuccess : ( ) => {
1619 queryClient . invalidateQueries ( { queryKey : [ QUERY_KEYS . FOLLOW_COUNT ] } ) ;
1720 notify ( 'success' , TOAST_MESSAGES . DELETE_FOLLOW_SUCCESS , 3000 ) ;
Original file line number Diff line number Diff line change 11import { useMutation , useQueryClient } from '@tanstack/react-query' ;
22
3- import { DELETE } from '@/apis/services/httpMethod' ;
3+ import { API } from '@/apis/services/httpMethod' ;
44import { API_ENDPOINTS } from '@/constants/ApiEndpoints' ;
55import { QUERY_KEYS } from '@/constants/QueryKeys' ;
66import { notify } from '@/store/useToastStore' ;
@@ -11,7 +11,7 @@ export const useDeleteGoalMutation = () => {
1111
1212 return useMutation ( {
1313 mutationFn : ( goalId : number ) =>
14- DELETE < DeleteGoalResponse > ( API_ENDPOINTS . GOAL . GOAL ( goalId ) ) ,
14+ API . delete < DeleteGoalResponse > ( API_ENDPOINTS . GOAL . GOAL ( goalId ) ) ,
1515 onSuccess : ( ) => {
1616 queryClient . invalidateQueries ( { queryKey : [ QUERY_KEYS . ALL_GOALS ] } ) ;
1717 queryClient . invalidateQueries ( { queryKey : [ QUERY_KEYS . GOALS ] } ) ;
Original file line number Diff line number Diff line change 11import { useMutation , useQueryClient } from '@tanstack/react-query' ;
2- import { DELETE } from '@/apis/services/httpMethod' ;
3- import { DeleteLikeResponse } from '@/types/Likes ' ;
2+
3+ import { API } from '@/apis/services/httpMethod ' ;
44import { API_ENDPOINTS } from '@/constants/ApiEndpoints' ;
5- import { notify } from '@/store/useToastStore' ;
65import { TOAST_MESSAGES } from '@/constants/Messages' ;
76import { QUERY_KEYS } from '@/constants/QueryKeys' ;
7+ import { notify } from '@/store/useToastStore' ;
8+ import { DeleteLikeResponse } from '@/types/Likes' ;
89
910export const useDeleteLike = ( ) => {
1011 const queryClient = useQueryClient ( ) ;
1112
1213 return useMutation < DeleteLikeResponse , Error , number > ( {
1314 mutationFn : ( completeId : number ) =>
14- DELETE < DeleteLikeResponse > ( API_ENDPOINTS . LIKE . DELETE ( completeId ) ) ,
15+ API . delete < DeleteLikeResponse > ( API_ENDPOINTS . LIKE . DELETE ( completeId ) ) ,
1516
1617 onSuccess : ( ) => {
1718 queryClient . invalidateQueries ( { queryKey : [ QUERY_KEYS . FOLLOWS ] } ) ;
You can’t perform that action at this time.
0 commit comments