14 lines
425 B
TypeScript
14 lines
425 B
TypeScript
import { deleteBillById } from '@/app/lib/billActions';
|
|
import { revalidatePath } from 'next/cache';
|
|
import { notFound, redirect } from 'next/navigation';
|
|
|
|
export default async function Page({ params:{ id } }: { params: { id:string } }) {
|
|
const [locationID, billID] = id.split('-');
|
|
|
|
if(await deleteBillById(locationID, billID) === 0) {
|
|
return(notFound());
|
|
}
|
|
|
|
revalidatePath('/');
|
|
redirect(`/`);
|
|
} |