"use client";
import { useState } from "react";
import { createUserWithEmailAndPassword, signInWithPopup } from "firebase/auth";
import { auth, googleProvider } from "@/lib/firebase";
import { useRouter } from "next/navigation";
import Navbar from "@/components/Navbar";
export default function SignupPage() {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const router = useRouter();
const handleSignup = async (e: React.FormEvent) => {
e.preventDefault();
try {
await createUserWithEmailAndPassword(auth, email, password);
router.push("/dashboard");
} catch (error: any) {
alert(error.message);
}
};
const handleGoogleLogin = async () => {
try {
await signInWithPopup(auth, googleProvider);
router.push("/dashboard");
} catch (error: any) {
alert(error.message);
}
};
return (
<>