модалка редактирования открывается более раза подряд
This commit is contained in:
parent
5b2a0a55dc
commit
1f060fc5e8
@ -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} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user