From f78a2bbc4c3956d8abeb5bc790f312e305891056 Mon Sep 17 00:00:00 2001 From: Prince Muel Date: Wed, 7 Jun 2023 23:24:10 +0100 Subject: [PATCH] chore: move error reporting to global handlers Reference-to: #47, #49 Signed-off-by: Prince Muel --- src/providers/index.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/providers/index.tsx b/src/providers/index.tsx index e13877e..67d06f5 100644 --- a/src/providers/index.tsx +++ b/src/providers/index.tsx @@ -47,7 +47,8 @@ const Providers = (props: Props) => { // }, onError: (error, query) => { if (query.state.data !== undefined) { - toast.error(`Something went wrong: ${getErrorMessage(error)}`); + //@ts-expect-error ignore expected error + toast.error(getErrorMessage(error?.response?.errors?.[0])); } }, }), @@ -60,7 +61,8 @@ const Providers = (props: Props) => { // }, onError: (error, variables, context, mutation) => { if (mutation.state.data !== undefined) { - toast.error(`Something went wrong: ${getErrorMessage(error)}`); + //@ts-expect-error ignore expected error + toast.error(getErrorMessage(error?.response?.errors?.[0])); } }, }),