diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-11-10 22:02:48 +0100 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-11-10 22:02:48 +0100 |
| commit | d0e07a0fc06a83ed45dd7c491e1475e340aa564e (patch) | |
| tree | 0f70522dc6869afb0f467ff5375bc75e27ea8f44 /frontend/src/components/modals/Modal.js | |
| parent | 2cf9276550b49bc102fb84a6debbbbac694d3e92 (diff) | |
Perform form validation in modals
This change updates the modal components to perform validation before
submitting the request.
Diffstat (limited to 'frontend/src/components/modals/Modal.js')
| -rw-r--r-- | frontend/src/components/modals/Modal.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/frontend/src/components/modals/Modal.js b/frontend/src/components/modals/Modal.js index b494d970..21b7f119 100644 --- a/frontend/src/components/modals/Modal.js +++ b/frontend/src/components/modals/Modal.js @@ -9,12 +9,14 @@ function Modal({ children, title, show, onSubmit, onCancel, submitButtonType, su const toggle = () => setModal(!modal) const cancel = () => { - toggle() - onCancel() + if (onCancel() !== false) { + toggle() + } } const submit = () => { - toggle() - onSubmit() + if (onSubmit() !== false) { + toggle() + } } return ( |
