Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
fix(Modal): onSubmit should support promises
Browse files Browse the repository at this point in the history
  • Loading branch information
cecilia-sanare committed Aug 28, 2021
1 parent aa08ca4 commit a83e8fb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions stories/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface ModalProps {
title?: ReactNode;
isSubmitDisabled?: boolean;
isSubmitLoading?: boolean;
onSubmit?: () => void;
onSubmit?: () => void | Promise<void>;
onCancel?: () => void;
opened: boolean;
size?: ModalSize;
Expand Down Expand Up @@ -104,9 +104,10 @@ export function Modal({
<Button
disabled={isSubmitDisabled}
loading={isSubmitLoading}
onClick={() => {
onClick={async () => {
await onSubmit();

setInternallyOpened(false);
onSubmit();
}}
>
Submit
Expand Down

0 comments on commit a83e8fb

Please sign in to comment.