Chapter 13 - Handle specific error (not found in this case)

This commit is contained in:
2024-01-03 09:47:57 +01:00
parent f3626ec7c0
commit 1c23830272
3 changed files with 24 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
import Form from '@/app/ui/invoices/edit-form';
import Breadcrumbs from '@/app/ui/invoices/breadcrumbs';
import {fetchCustomers, fetchInvoiceById} from '@/app/lib/data';
import { notFound } from 'next/navigation';
export default async function Page({ params }: { params: { id: string } }) {
const id = params.id;
@@ -8,6 +9,10 @@ export default async function Page({ params }: { params: { id: string } }) {
fetchInvoiceById(id),
fetchCustomers(),
]);
if (!invoice) {
notFound();
}
return (
<main>
<Breadcrumbs