import { notFound } from 'next/navigation';
import { fetchLocationById } from '@/app/lib/actions/locationActions';
import { LocationDeleteForm } from '@/app/ui/LocationDeleteForm';
import { Main } from '@/app/ui/Main';

export default async function Page({ params:{ id } }: { params: { id:string } }) {

    const location = await fetchLocationById(id);

    if (!location) {
        return(notFound());
    }

    return (
        <Main>
            <LocationDeleteForm location={location} />
        </Main>
    );
}