Fix missing redirect after login success

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-03-13 19:40:09 +01:00
parent 5ca45552f1
commit dfe53df7a2

View File

@@ -1,5 +1,5 @@
import { useState, useEffect } from "react";
import { Link, useLocation } from "react-router";
import { Link, useLocation, useNavigate } from "react-router";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
@@ -12,6 +12,7 @@ export default function LoginPage() {
const [isLoading, setIsLoading] = useState(false);
const { toast } = useToast();
const location = useLocation();
const navigate = useNavigate();
useEffect(() => {
if (location.state?.authRequired) {
@@ -53,6 +54,8 @@ export default function LoginPage() {
} finally {
setIsLoading(false);
}
navigate("/");
};
return (