'use client';

import useRequest from '@/hooks/useRequest';
import { party_requests } from '@/data/party/party.requests';
import Loader from '@/components/common/Loader';
import React from 'react';
import DashboardCreateRealBoxPage from '@/routes/private/real-boxes-create/DashboardCreateRealBox';

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 <DashboardCreateRealBoxPage partiesData={partiesData.data} />;
}
