BillEditForm: added location title @ top
This commit is contained in:
6
app/bill/[id]/add/not-found.tsx
Normal file
6
app/bill/[id]/add/not-found.tsx
Normal 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;
|
||||||
@@ -1,12 +1,19 @@
|
|||||||
import { fetchLocationById } from '@/app/lib/actions/locationActions';
|
import { fetchLocationById } from '@/app/lib/actions/locationActions';
|
||||||
import { BillEditForm } from '@/app/ui/BillEditForm';
|
import { BillEditForm } from '@/app/ui/BillEditForm';
|
||||||
import { Main } from '@/app/ui/Main';
|
import { Main } from '@/app/ui/Main';
|
||||||
|
import { notFound } from 'next/navigation';
|
||||||
|
|
||||||
export default async function Page({ params:{ id:locationID } }: { params: { id:string } }) {
|
export default async function Page({ params:{ id:locationID } }: { params: { id:string } }) {
|
||||||
|
|
||||||
|
const location = await fetchLocationById(locationID);
|
||||||
|
|
||||||
|
if (!location) {
|
||||||
|
return(notFound());
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Main>
|
<Main>
|
||||||
<BillEditForm locationID={locationID} />
|
<BillEditForm location={location} />
|
||||||
</Main>
|
</Main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -9,12 +9,12 @@ export default async function Page({ params:{ id } }: { params: { id:string } })
|
|||||||
|
|
||||||
const [location, bill] = await fetchBillById(locationID, billID) ?? [];
|
const [location, bill] = await fetchBillById(locationID, billID) ?? [];
|
||||||
|
|
||||||
if (!bill) {
|
if (!bill || !location) {
|
||||||
return(notFound());
|
return(notFound());
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Main>
|
<Main>
|
||||||
<BillEditForm locationID={locationID} bill={bill} billYear={location?.yearMonth.year} />
|
<BillEditForm location={location} bill={bill} />
|
||||||
</Main>
|
</Main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user