fix: nextauth v5 redirectTo, email provider signIn without redirect:false

This commit is contained in:
Romain bogdanovic 2026-03-28 20:27:50 +01:00
parent bf454b58a3
commit 913c8a6aaf
2 changed files with 3 additions and 10 deletions

View File

@ -21,19 +21,12 @@ export default function LoginPage() {
setError("");
try {
const result = await signIn("resend", {
await signIn("resend", {
email,
redirect: false,
callbackUrl: `/${locale}/dashboard`,
redirectTo: `/${locale}/auth/verify`,
});
if (result?.error) {
setError("Une erreur est survenue. Vérifiez votre adresse email.");
} else {
window.location.href = `/${locale}/auth/verify`;
}
} catch {
setError("Une erreur est survenue.");
} finally {
setLoading(false);
}
};

View File

@ -118,7 +118,7 @@ export function Nav({ locale, userRole, isLoggedIn }: NavProps) {
{/* Auth button */}
{isLoggedIn ? (
<button
onClick={() => signOut({ callbackUrl: `/${locale}` })}
onClick={() => signOut({ redirectTo: `/${locale}` })}
className="btn btn-secondary"
style={{ fontSize: 13 }}
>