update to raise NOT_FOUND error when no resource found

This commit is contained in:
Brandon Egger
2023-08-29 10:30:18 -05:00
parent f180fb8fd1
commit 8895fc31b4
3 changed files with 33 additions and 15 deletions

View File

@ -12,7 +12,7 @@ import { api } from "~/utils/api";
import { useRouter } from "next/router";
import { HeaderFooterLayout } from "~/layouts/HeaderFooterLayout";
import { QueryWaitWrapper } from "~/components/LoadingWrapper";
import { AuditoryResource } from "@prisma/client";
import { type AuditoryResource } from "@prisma/client";
const EditResourcePage = () => {
const router = useRouter();
@ -20,7 +20,13 @@ const EditResourcePage = () => {
const resourceQuery = api.auditoryResource.byId.useQuery(
{ id },
{ enabled: router.isReady }
{
enabled: router.isReady,
onError(err) {
console.log(err);
throw err;
},
}
);
const ConditionalView = (data: AuditoryResource) => {