Skip to content

Commit

Permalink
chore: remove react-hook-form from RemoveSecretDialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitdevos committed May 16, 2024
1 parent 42ef926 commit bb89303
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions src/loc/secrets/RemoveSecretDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Secret } from "@logion/client";
import Dialog from "../../common/Dialog";
import { useForm } from "react-hook-form";
import { useCallback } from "react";
import Icon from "../../common/Icon";
import ViewableSecret from "./ViewableSecret";
import "./RemoveSecretDialog.css"
Expand All @@ -13,18 +11,6 @@ export interface Props {
}

export default function RemoveSecretDialog(props: Props) {
const { handleSubmit, reset } = useForm<{}>();

const cancel = useCallback(() => {
props.onCancel();
reset();
}, [ props, reset ])

const submit = useCallback((_: {}) => {
props.onRemoveSecret(props.secret!);
reset();
}, [ props, reset ])

return (
<Dialog
className="RemoveSecretDialog"
Expand All @@ -35,16 +21,15 @@ export default function RemoveSecretDialog(props: Props) {
id: "cancel",
buttonText: "Cancel",
buttonVariant: "secondary",
callback: cancel,
callback: props.onCancel,
},
{
id: "remove",
buttonText: "Remove",
buttonVariant: "primary",
type: "submit",
callback: () => props.onRemoveSecret(props.secret!),
}
] }
onSubmit={ handleSubmit(submit) }
>
<Icon icon={{id: "big-warning"}} type="png" height="70px"/>
<p>You are about to remove the secret <strong>{ props.secret?.name }</strong>:</p>
Expand Down

0 comments on commit bb89303

Please sign in to comment.