import { notFound } from 'next/navigation';
import { LocationEditForm } from '@/app/ui/LocationEditForm';
import { fetchLocationById } from '@/app/lib/actions/locationActions';
import { getUserSettings } from '@/app/lib/actions/userSettingsActions';

export default async function LocationEditPage({ locationId }: { locationId:string }) {

    const location = await fetchLocationById(locationId);

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

    const userSettings = await getUserSettings();

    const result = <LocationEditForm location={location} userSettings={userSettings} />;

    return (result);
}