added retry count to global react-query setup
This commit is contained in:
+2
-1
@@ -9,7 +9,8 @@ function App() {
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
// staleTime: Infinity,
|
||||
refetchOnWindowFocus: false
|
||||
refetchOnWindowFocus: false,
|
||||
retry: 3,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -5,11 +5,11 @@ import queryKeys from "../../services/queryKeys";
|
||||
|
||||
export default function RecentActions() {
|
||||
|
||||
const {data, isFetching, isError} = useQuery({
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.recentAction,
|
||||
queryFn: async () => await recentActions()
|
||||
})
|
||||
console.log('data', data)
|
||||
console.log('data', error)
|
||||
return (
|
||||
<>
|
||||
<div className="card card-statistics h-100 mb-0">
|
||||
@@ -33,7 +33,7 @@ console.log('data', data)
|
||||
: isError ?
|
||||
<div className="row">
|
||||
<div className="col-12">
|
||||
<p className='text-danger'>Error occured! Please refresh to continue</p>
|
||||
<p className='text-danger'>{error.message}</p>
|
||||
</div>
|
||||
</div>
|
||||
:
|
||||
|
||||
@@ -36,7 +36,8 @@ const getAuxEnd = (path) => {
|
||||
// localStorage.clear();
|
||||
// window.location.href = `/login?sessionExpired=true`;
|
||||
}).catch(err => {
|
||||
throw new Error(err.response.data.message);
|
||||
throw new Error(err);
|
||||
// throw new Error(err.response.data.message);
|
||||
// return err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user