"use client"; import { useState } from "react"; import Link from "next/link"; export default function AdminSetupPage() { const [fullName, setFullName] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const [success, setSuccess] = useState(false); const handleSetup = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(null); try { const res = await fetch("/api/admin/setup", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email, password, full_name: fullName }), }); const data = await res.json(); if (!res.ok) throw new Error(data.error); setSuccess(true); } catch (err) { setError(err instanceof Error ? err.message : "Erreur lors de la création."); } finally { setLoading(false); } }; if (success) { return (

Compte admin créé !

Ton compte admin a été créé avec succès. Connecte-toi pour accéder au panel d'administration.

Se connecter
); } return (
H
HookLab

Configuration admin

Crée ton compte administrateur. Cette page ne fonctionne qu'une seule fois.

setFullName(e.target.value)} required className="w-full px-4 py-3 bg-dark-lighter border border-dark-border rounded-xl text-white placeholder-white/30 text-sm focus:outline-none focus:border-primary" />
setEmail(e.target.value)} required className="w-full px-4 py-3 bg-dark-lighter border border-dark-border rounded-xl text-white placeholder-white/30 text-sm focus:outline-none focus:border-primary" />
setPassword(e.target.value)} required minLength={8} className="w-full px-4 py-3 bg-dark-lighter border border-dark-border rounded-xl text-white placeholder-white/30 text-sm focus:outline-none focus:border-primary" />
{error && (

{error}

)}
); }