export function ResendEmail({ locale, email }: { locale: Locale, email: string }) {
const { t } = useTranslation(locale);
const handleResendEmail = async () => {
// const response = await fetch('/api/register/email/resend', {
// method: 'POST',
// body: JSON.stringify({ email }),
// });
// if (response.ok) {
// console.log('Email sent successfully');
// } else {
// console.error('Failed to send email');
// }
const callbackURL = "/"
const { data, error } = await authClient.sendVerificationEmail({
email,
callbackURL
});
if (error) {
console.error(error);
}
if (data) {
console.log(data);
}
}
return (
<Button className="w-full" variant="outline" onClick={handleResendEmail}>
{t('pages.emailConfirmation.resendEmail')}
</Button>
)
}
export function ResendEmail({ locale, email }: { locale: Locale, email: string }) {
const { t } = useTranslation(locale);
const handleResendEmail = async () => {
// const response = await fetch('/api/register/email/resend', {
// method: 'POST',
// body: JSON.stringify({ email }),
// });
// if (response.ok) {
// console.log('Email sent successfully');
// } else {
// console.error('Failed to send email');
// }
const callbackURL = "/"
const { data, error } = await authClient.sendVerificationEmail({
email,
callbackURL
});
if (error) {
console.error(error);
}
if (data) {
console.log(data);
}
}
return (
<Button className="w-full" variant="outline" onClick={handleResendEmail}>
{t('pages.emailConfirmation.resendEmail')}
</Button>
)
}