feat: proper redirect handling
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { Mail, Lock, User, Phone } from "lucide-react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Link, useLocation } from "react-router-dom";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
@ -23,6 +23,8 @@ export default function RegisterPage() {
|
||||
formState: { errors },
|
||||
} = useForm<RegisterForm>();
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
const [success, setSuccess] = useState("");
|
||||
@ -238,7 +240,11 @@ export default function RegisterPage() {
|
||||
</Button>
|
||||
<div className="text-sm text-center text-gray-600">
|
||||
Already have an account?{" "}
|
||||
<Link to="/login" className="text-blue-600 hover:underline">
|
||||
<Link
|
||||
to="/login"
|
||||
state={location.state}
|
||||
className="text-blue-600 hover:underline"
|
||||
>
|
||||
Login
|
||||
</Link>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user