'use client';

import Loader from '@/components/common/Loader';
import { party_requests } from '@/data/party/party.requests';
import useRequest from '@/hooks/useRequest';
import DashboardCreateForbiddenPage from '@/routes/private/forbidden-create/DashboardCreateForbiddenPage';

export default function Home() {
    const partiesData = useRequest(() => party_requests.getAll({ status: 'COLLECTING' }), {
        selectData(data) {
            return data.data.data.data.map(p => ({ value: p.id, label: p.name }));
        },
        placeholderData: [],
    });

    if (partiesData.loading || !partiesData.data) {
        return <Loader p={8} size={96} />;
    }

    return <DashboardCreateForbiddenPage partiesData={partiesData.data} />;
}
