Skip to content

Commit

Permalink
feat: add close modal
Browse files Browse the repository at this point in the history
  • Loading branch information
G3root committed Oct 7, 2024
1 parent f117e7f commit 63fc004
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/modals/safe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type SafeModalProps = {
export const SafeModal: React.FC<SafeModalProps> = ({ type }) => {
const [open, setOpen] = useState(true);

const handleClose = () => setOpen(false);
return (
<Modal
size="4xl"
Expand Down Expand Up @@ -80,7 +81,7 @@ export const SafeModal: React.FC<SafeModalProps> = ({ type }) => {
},
}}
>
<SafeForm type={type} />
<SafeForm handleClose={handleClose} type={type} />
</Modal>
);
};
5 changes: 4 additions & 1 deletion src/components/safe/form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { useSession } from "next-auth/react";

type SafeFormProps = {
type: "create" | "import";
handleClose: () => void;
};

const SafeFormSchema = z.object({
Expand All @@ -53,7 +54,7 @@ type SafeFormType = z.infer<typeof SafeFormSchema>;

const placeholder = "________________________________________";

export const SafeForm: React.FC<SafeFormProps> = ({ type }) => {
export const SafeForm: React.FC<SafeFormProps> = ({ type, handleClose }) => {
const { data: session } = useSession();
const { mutate } = useMutation(createSafe);

Expand All @@ -75,6 +76,8 @@ export const SafeForm: React.FC<SafeFormProps> = ({ type }) => {
json: { ...data },
urlParams: { companyId: session?.user.companyId ?? "" },
});

handleClose();
};

return (
Expand Down

0 comments on commit 63fc004

Please sign in to comment.