Fix react-query onError type error
The `onError` option was not correctly typed in the react-query configuration. This commit updates the type definition to resolve the TypeScript error.
This commit is contained in:
16
src/App.tsx
16
src/App.tsx
@@ -39,15 +39,19 @@ const queryClient = new QueryClient({
|
|||||||
queries: {
|
queries: {
|
||||||
retry: 1,
|
retry: 1,
|
||||||
refetchOnWindowFocus: false,
|
refetchOnWindowFocus: false,
|
||||||
// 오류 처리 추가
|
meta: {
|
||||||
onError: (error) => {
|
// meta 객체를 사용하여 오류 관리
|
||||||
console.error("쿼리 오류:", error);
|
errorHandler: (error: Error) => {
|
||||||
|
console.error("쿼리 오류:", error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
// 오류 처리 추가
|
// onSettled를 사용하여 완료 시 호출되는 콜백 설정
|
||||||
onError: (error) => {
|
onSettled: (_data, error) => {
|
||||||
console.error("뮤테이션 오류:", error);
|
if (error) {
|
||||||
|
console.error("뮤테이션 오류:", error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user