import { useDealPageContext } from "../../../contexts/DealPageContext.tsx";
import { DealService } from "../../../../../client";

const useUpdateDeal = () => {
    const { selectedDeal: deal, setSelectedDeal } = useDealPageContext();

    const update = () => {
        if (!deal) return;
        DealService.getDealById({ dealId: deal.id })
            .then(data => {
                setSelectedDeal(data);
            });
    };

    return { update };
};

export default useUpdateDeal;
