Fix sign-in does not include cookie

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-03-19 10:32:01 +01:00
parent b2d06616fd
commit a13dc99173

View File

@@ -36,6 +36,7 @@ export default function LoginPage() {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
credentials: "include",
body: JSON.stringify({ email, password }), body: JSON.stringify({ email, password }),
} }
); );
@@ -44,6 +45,8 @@ export default function LoginPage() {
const error = await response.json(); const error = await response.json();
throw new Error(error.message || "Failed to login"); throw new Error(error.message || "Failed to login");
} }
navigate("/", { replace: true });
} catch (error: unknown) { } catch (error: unknown) {
toast({ toast({
title: "Error", title: "Error",
@@ -53,8 +56,6 @@ export default function LoginPage() {
} finally { } finally {
setIsLoading(false); setIsLoading(false);
} }
navigate("/");
}; };
return ( return (