diff --git a/frontend/src/modals/CertificateCreateModal.tsx b/frontend/src/modals/CertificateCreateModal.tsx index 07a4f45f..59cab44c 100644 --- a/frontend/src/modals/CertificateCreateModal.tsx +++ b/frontend/src/modals/CertificateCreateModal.tsx @@ -1,5 +1,8 @@ +import { useState } from "react"; + import { Button, + ButtonGroup, FormControl, FormErrorMessage, FormLabel, @@ -29,9 +32,15 @@ function CertificateCreateModal({ isOpen, onClose, }: CertificateCreateModalProps) { + const [certType, setCertType] = useState(""); const toast = useToast(); const { mutate: setCertificate } = useSetCertificate(); + const onModalClose = () => { + onClose(); + setCertType(""); + }; + const onSubmit = async ( payload: Certificate, { setErrors, setSubmitting }: any, @@ -60,13 +69,13 @@ function CertificateCreateModal({ showErr(err.message); } }, - onSuccess: () => onClose(), + onSuccess: () => onModalClose(), onSettled: () => setSubmitting(false), }); }; return ( - + - - - {({ field, form }: any) => ( - - - {intl.formatMessage({ - id: "name", - })} - - - {form.errors.name} - - )} - - + {certType === "" ? ( + + + Select the Certificate Validation method + + + + + + + ) : null} + + {certType !== "" ? ( + + + {({ field, form }: any) => ( + + + {intl.formatMessage({ + id: "name", + })} + + + + {form.errors.name} + + + )} + + + ) : null} - - {intl.formatMessage({ id: "form.save" })} - -