"use client" import { useState } from "react" import { useRouter } from "next/navigation" import { JefflixLogo } from "@/components/jefflix-logo" export default function GatePage() { const [code, setCode] = useState("") const [error, setError] = useState("") const [loading, setLoading] = useState(false) const router = useRouter() async function handleSubmit(e: React.FormEvent) { e.preventDefault() setError("") setLoading(true) const res = await fetch("/api/verify-code", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ code }), }) if (res.ok) { router.push("/") router.refresh() } else { setError("Wrong code. Try again.") setLoading(false) } } return (
Enter the access code to continue