diff --git a/app/bill/[id]/add/not-found.tsx b/app/bill/[id]/add/not-found.tsx new file mode 100644 index 0000000..d9d84b1 --- /dev/null +++ b/app/bill/[id]/add/not-found.tsx @@ -0,0 +1,6 @@ +import { NotFoundPage } from '@/app/ui/NotFoundPage'; + +const BillNotFound = () => +; + +export default BillNotFound; diff --git a/app/bill/[id]/add/page.tsx b/app/bill/[id]/add/page.tsx index fbb92da..bae6db8 100644 --- a/app/bill/[id]/add/page.tsx +++ b/app/bill/[id]/add/page.tsx @@ -1,12 +1,19 @@ import { fetchLocationById } from '@/app/lib/actions/locationActions'; import { BillEditForm } from '@/app/ui/BillEditForm'; import { Main } from '@/app/ui/Main'; +import { notFound } from 'next/navigation'; export default async function Page({ params:{ id:locationID } }: { params: { id:string } }) { + const location = await fetchLocationById(locationID); + + if (!location) { + return(notFound()); + } + return (
- +
); } \ No newline at end of file diff --git a/app/bill/[id]/edit/page.tsx b/app/bill/[id]/edit/page.tsx index 1d97ce4..eda8bea 100644 --- a/app/bill/[id]/edit/page.tsx +++ b/app/bill/[id]/edit/page.tsx @@ -9,12 +9,12 @@ export default async function Page({ params:{ id } }: { params: { id:string } }) const [location, bill] = await fetchBillById(locationID, billID) ?? []; - if (!bill) { + if (!bill || !location) { return(notFound()); } return (
- +
); } \ No newline at end of file