update query wait to use error message if one is available

This commit is contained in:
Brandon Egger
2023-08-29 10:48:11 -05:00
parent 8895fc31b4
commit 562ff8d2a6
3 changed files with 22 additions and 9 deletions

View File

@ -22,9 +22,8 @@ const EditResourcePage = () => {
{ id },
{
enabled: router.isReady,
onError(err) {
console.log(err);
throw err;
retry(_failureCount, error) {
return error.data?.httpStatus !== 404;
},
}
);

View File

@ -82,7 +82,14 @@ const ResourceViewPage = () => {
const router = useRouter();
const id = router.query["id"]?.toString() ?? "";
const resourceQuery = api.auditoryResource.byId.useQuery({ id });
const resourceQuery = api.auditoryResource.byId.useQuery(
{ id },
{
retry(_failureCount, error) {
return error.data?.httpStatus !== 404;
},
}
);
const ConditionalView = (data: AuditoryResource) => {
return (