completed location deletion
This commit is contained in:
4
app/location/[id]/delete/not-found.tsx
Normal file
4
app/location/[id]/delete/not-found.tsx
Normal file
@@ -0,0 +1,4 @@
|
||||
import { NotFoundPage } from '@/app/ui/NotFoundPage';
|
||||
|
||||
export default () =>
|
||||
<NotFoundPage title="404 Billing Location Not Found" description="Could not find the requested Billing Location." />;
|
||||
15
app/location/[id]/delete/page.tsx
Normal file
15
app/location/[id]/delete/page.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import { deleteBillById } from '@/app/lib/billActions';
|
||||
import { deleteLocationById } from '@/app/lib/locationActions';
|
||||
import { revalidatePath } from 'next/cache';
|
||||
import { notFound, redirect } from 'next/navigation';
|
||||
|
||||
export default async function Page({ params:{ id } }: { params: { id:string } }) {
|
||||
const locationID = id;
|
||||
|
||||
if(await deleteLocationById(locationID) === 0) {
|
||||
return(notFound());
|
||||
}
|
||||
|
||||
revalidatePath('/');
|
||||
redirect(`/`);
|
||||
}
|
||||
Reference in New Issue
Block a user