Files
formbricks/apps/web/components/auth/RequestVerificationEmail.tsx
Matti Nannt 60f7103198 Revert & gradually use updated files (#280)
* revert to last working version

* add updated ui components

* update formbricks-com components

* apply prettier formatting

* update apps/web files
2023-05-10 00:20:43 +02:00

29 lines
823 B
TypeScript

"use client";
import { Button } from "@formbricks/ui";
import { resendVerificationEmail } from "@/lib/users/users";
import toast from "react-hot-toast";
interface RequestEmailVerificationProps {
email: string | null;
}
export const RequestVerificationEmail = ({ email }: RequestEmailVerificationProps) => {
const requestVerificationEmail = async () => {
try {
if (!email) throw new Error("No email provided");
await resendVerificationEmail(email);
toast.success("Verification email successfully sent. Please check your inbox.");
} catch (e) {
toast.error(`Error: ${e.message}`);
}
};
return (
<>
<Button variant="secondary" onClick={requestVerificationEmail} className="w-full justify-center">
Request a new verification mail
</Button>
</>
);
};