diff --git a/src/App.tsx b/src/App.tsx index 3b19b0e..2fe73cc 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -7,9 +7,8 @@ import { QueryCache, useQuery, } from '@tanstack/react-query'; -import toast, { useToaster } from './core/headless'; +import toast from './core/headless'; -const notify = () => toast('Here is your toast.'); const promise = () => { toast.promise( new Promise(r => setTimeout(r, 5000)), @@ -23,17 +22,20 @@ const promise = () => { const client = new QueryClient({ queryCache: new QueryCache({ - onError: () => { - error('KOKO'); + onError: (err) => { + toast.error(err.message) }, + onSuccess: (_data) => { + toast.success("All good1") + } }), }); const App = () => { - const data = useQuery({ + useQuery({ queryKey: ['foo'], retry: false, - queryFn: () => Promise.reject('fido'), + queryFn: () => Promise.reject(new Error("500: Server is using Nodejs")), }); return (