diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx new file mode 100644 index 0000000..423e454 --- /dev/null +++ b/src/app/login/page.tsx @@ -0,0 +1,121 @@ +"use client"; + +import { useState } from "react"; +import { useRouter } from "next/navigation"; + +export default function LoginPage() { + const router = useRouter(); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const [error, setError] = useState(""); + const [isLoading, setIsLoading] = useState(false); + + const handleLogin = async (e: React.FormEvent) => { + e.preventDefault(); + setError(""); + setIsLoading(true); + + try { + // Simulate login API call + if (!email || !password) { + setError("Please enter both email and password."); + return; + } + + // Here you would typically make an API call to authenticate + // For now, we'll simulate a successful login + console.log("Login attempt:", { email, password }); + + // Simulate successful login + localStorage.setItem("user_email", email); + router.push("/dashboard"); + } catch (err) { + setError("Login failed. Please try again."); + console.error(err); + } finally { + setIsLoading(false); + } + }; + + const handleRegister = () => { + router.push("/#contact"); + }; + + return ( +
Login to your account
+ + + ++ Don't have an account?{" "} + +
+