39 lines
966 B
TypeScript
39 lines
966 B
TypeScript
import type { Metadata } from "next";
|
|
import { notFound } from "next/navigation";
|
|
import { fetchCustomers, fetchInvoiceById } from "@/app/lib/data";
|
|
import Breadcrumbs from "@/app/ui/invoices/breadcrumbs";
|
|
import Form from "@/app/ui/invoices/edit-form";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Edit invoices",
|
|
};
|
|
|
|
export default async function Page(props: { params: Promise<{ id: string }> }) {
|
|
const params = await props.params;
|
|
const id = params.id;
|
|
const [invoice, customers] = await Promise.all([
|
|
fetchInvoiceById(id),
|
|
fetchCustomers(),
|
|
]);
|
|
|
|
if (!invoice) {
|
|
notFound();
|
|
}
|
|
|
|
return (
|
|
<main>
|
|
<Breadcrumbs
|
|
breadcrumbs={[
|
|
{ label: "Invoices", href: "/dashboard/invoices" },
|
|
{
|
|
label: "Edit Invoice",
|
|
href: `/dashboard/invoices/${id}/edit`,
|
|
active: true,
|
|
},
|
|
]}
|
|
/>
|
|
<Form invoice={invoice} customers={customers} />
|
|
</main>
|
|
);
|
|
}
|