import { useEffect, useState } from "react"; import type { Service } from "@groombook/types"; export function ServicesPage() { const [services, setServices] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { fetch("/api/services") .then((r) => { if (!r.ok) throw new Error(`HTTP ${r.status}`); return r.json() as Promise; }) .then(setServices) .catch((e: unknown) => setError(e instanceof Error ? e.message : "Unknown error") ) .finally(() => setLoading(false)); }, []); if (loading) return

Loading services…

; if (error) return

Error: {error}

; return (

Services

{services.length === 0 ? (

No services configured yet.

) : (
    {services.map((s) => (
  • {s.name} — ${(s.basePriceCents / 100).toFixed(2)} /{" "} {s.durationMinutes} min
  • ))}
)}
); }