BillEditForm: added location title @ top

This commit is contained in:
2024-01-17 16:06:54 +01:00
parent bdf9c10303
commit c7c7bf2924
3 changed files with 16 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
import { NotFoundPage } from '@/app/ui/NotFoundPage';
const BillNotFound = () =>
<NotFoundPage title="404 Bill Not Found" description="Could not find the requested Bill." />;
export default BillNotFound;

View File

@@ -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 (
<Main>
<BillEditForm locationID={locationID} />
<BillEditForm location={location} />
</Main>
);
}

View File

@@ -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 (
<Main>
<BillEditForm locationID={locationID} bill={bill} billYear={location?.yearMonth.year} />
<BillEditForm location={location} bill={bill} />
</Main>
);
}