From 78fda7e228b561171114434c65413c48e8ecb2e5 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 05:19:47 +0000 Subject: [PATCH] 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. --- src/App.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 65ac2a3..272fb3e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -39,15 +39,19 @@ const queryClient = new QueryClient({ queries: { retry: 1, refetchOnWindowFocus: false, - // 오류 처리 추가 - onError: (error) => { - console.error("쿼리 오류:", error); + meta: { + // meta 객체를 사용하여 오류 관리 + errorHandler: (error: Error) => { + console.error("쿼리 오류:", error); + } } }, mutations: { - // 오류 처리 추가 - onError: (error) => { - console.error("뮤테이션 오류:", error); + // onSettled를 사용하여 완료 시 호출되는 콜백 설정 + onSettled: (_data, error) => { + if (error) { + console.error("뮤테이션 오류:", error); + } } } },