Skip to content

Commit

Permalink
Merge pull request #234 from bcgov/ticdi-81-clear-modal-onhide
Browse files Browse the repository at this point in the history
TICDI-81 - update fixing add provision modal not clearing
  • Loading branch information
mgtennant authored Sep 6, 2024
2 parents 1b219f6 + d7ea161 commit 320db1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const AddProvisionModal: React.FC<AddProvisionModalProps> = ({ show, addProvisio
};

await addProvisionHandler(provisionUpload);
onHide();
handleOnHide();
} catch (err) {
console.log('Error adding provision');
console.log(err);
Expand All @@ -78,13 +78,19 @@ const AddProvisionModal: React.FC<AddProvisionModalProps> = ({ show, addProvisio
}
};

const handleOnHide = () => {
onHide();
setListEnabled(false);
setListItems(['']);
};

return (
<Modal show={show} onHide={onHide} size="lg">
<Modal show={show} onHide={handleOnHide} size="lg">
<Modal.Header>
<Modal.Title>Add Provision</Modal.Title>
<Button
variant="none"
onClick={onHide}
onClick={handleOnHide}
style={{
marginLeft: 'auto',
border: 'none',
Expand Down Expand Up @@ -176,7 +182,7 @@ const AddProvisionModal: React.FC<AddProvisionModalProps> = ({ show, addProvisio
</Form>
</Modal.Body>
<Modal.Footer>
<Button variant="secondary" onClick={onHide}>
<Button variant="secondary" onClick={handleOnHide}>
Cancel
</Button>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ const EditProvisionModalForm: React.FC<EditProvisionModalFormProps> = ({
help_text: helpText,
category: category,
};
console.log(provisionUpload);
updateProvisionHandler(provisionUpload, provision.id);
}
};
Expand Down

0 comments on commit 320db1f

Please sign in to comment.