File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export const useHandleError = () => {
88 const handleError = ( error : Error , customMessage ?: string ) => {
99 if ( isAxiosError < ErrorResponse > ( error ) ) {
1010 openToast ( {
11- message : error . response ?. data . message || customMessage || '알 수 없는 오류가 발생했습니다' ,
11+ message : customMessage || error . response ?. data . message || '알 수 없는 오류가 발생했습니다' ,
1212 } ) ;
1313 }
1414 } ;
Original file line number Diff line number Diff line change 1+ import { useHandleError } from '@/common/hooks/useHandleError' ;
12import client from '@/common/utils/client' ;
23import { QUERY_KEYS } from '@/libs/queryKeys' ;
34import { useMutation , useQueryClient } from '@tanstack/react-query' ;
@@ -9,12 +10,16 @@ const postLike = async (itemId: number) => {
910
1011export const usePostLike = ( ) => {
1112 const queryClient = useQueryClient ( ) ;
13+ const handleError = useHandleError ( ) ;
1214
1315 return useMutation ( {
1416 mutationFn : postLike ,
1517 onSuccess : ( ) => {
1618 queryClient . invalidateQueries ( { queryKey : [ QUERY_KEYS . ITEM_DETAIL ] } ) ;
1719 queryClient . invalidateQueries ( { queryKey : [ QUERY_KEYS . ITEM_LIST ] } ) ;
1820 } ,
21+ onError : error => {
22+ handleError ( error , '로그인 후 시도해 주세요.' ) ;
23+ } ,
1924 } ) ;
2025} ;
Original file line number Diff line number Diff line change 1- export const VERSION_NAME = 'v1.0.1 ' ;
1+ export const VERSION_NAME = 'v1.0.2 ' ;
22
33export const MAX_PRICE = 999999 ;
44export const MAX_LOCATION = 100 ;
You can’t perform that action at this time.
0 commit comments