import React, { useEffect } from "react"; import { useLocation, useNavigate } from "react-router-dom"; import { useAuth } from "@web/src/providers/auth-provider"; import { RegisterForm } from "./register"; import { LoginForm } from "./login"; import { Card, Typography, Button, Spin, Divider } from "antd"; import { AnimatePresence, motion } from "framer-motion"; import { useAuthForm } from "./useAuthForm"; const { Title, Text, Paragraph } = Typography; const AuthPage: React.FC = () => { const { showLogin, isLoading, toggleForm, handleLogin, handleRegister } = useAuthForm(); const { isAuthenticated } = useAuth(); const location = useLocation(); const navigate = useNavigate(); useEffect(() => { if (isAuthenticated) { const params = new URLSearchParams(location.search); const redirectUrl = params.get("redirect_url") || "/"; navigate(redirectUrl, { replace: true }); } }, [isAuthenticated, location]); return (