import { deleteBillById } from '@/app/lib/actions/billActions';
import { deleteLocationById } from '@/app/lib/actions/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(`/`);
}