"use client"; import { useState, useTransition } from "react"; import { entferneLogo, ladeLogoHoch } from "@/app/firma/actions"; import { Alert } from "@/components/ui/Alert"; import { Button } from "@/components/ui/Button"; import { FIELD_CLASSES, FormField } from "@/components/ui/FormField"; export function LogoForm({ hatLogo }: { hatLogo: boolean }) { const [fehler, setFehler] = useState(null); const [isPending, startTransition] = useTransition(); function handleSubmit(event: React.FormEvent) { event.preventDefault(); const form = event.currentTarget; const formData = new FormData(form); startTransition(async () => { const ergebnis = await ladeLogoHoch(formData); setFehler(ergebnis.success ? null : ergebnis.error); if (ergebnis.success) form.reset(); }); } function handleEntfernen() { startTransition(async () => { const ergebnis = await entferneLogo(); setFehler(ergebnis.success ? null : ergebnis.error); }); } return (
{fehler && (
{fehler}
)} {hatLogo && ( // eslint-disable-next-line @next/next/no-img-element -- eigene Logo-Route mit Session-Cookie Aktuelles Logo )}
{hatLogo && ( )}
); }