модалка редактирования открывается более раза подряд

This commit is contained in:
Nastya 2023-07-26 04:28:00 +03:00
parent 5b2a0a55dc
commit 1f060fc5e8
2 changed files with 4 additions and 3 deletions

@ -45,9 +45,10 @@ const editTariff = ({ tarifIid, tariffName, tariffPrice, privilege }: EditProps)
};
interface Props {
tariff: Tariff;
closeModal: () => void
}
export default function EditModal({ tariff = undefined }: Props) {
export default function EditModal({ tariff = undefined, closeModal }: Props) {
const [open, setOpen] = useState(false);
const [name, setName] = useState("");
const [price, setPrice] = useState("");
@ -61,7 +62,7 @@ export default function EditModal({ tariff = undefined }: Props) {
return (
<Modal
open={open}
onClose={() => setOpen(false)}
onClose={() => closeModal(undefined)}
aria-labelledby="modal-modal-title"
aria-describedby="modal-modal-description"
>

@ -145,7 +145,7 @@ export default function TariffsDG({ selectedTariffs, handleSelectionChange }: Pr
}}
selectedTariffs={selectedTariffs}
/>
<EditModal tariff={changingTariff} />
<EditModal tariff={changingTariff} closeModal={setChangingTariff} />
</>
);
}