fix: nextauth v5 redirectTo, email provider signIn without redirect:false
This commit is contained in:
parent
bf454b58a3
commit
913c8a6aaf
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 }}
|
||||
>
|
||||
|
|
|
|||
Loading…
Reference in New Issue