Fix sign-in does not include cookie
Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
@@ -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 (
|
||||||
|
|||||||
Reference in New Issue
Block a user