import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Textarea } from "@/components/ui/textarea"; import { MapPin, Phone, Mail } from "lucide-react"; import { toast } from "sonner"; const apiBase = import.meta.env.VITE_API_URL; const ContactSection = () => { const [form, setForm] = useState({ firstName: "", lastName: "", email: "", subject: "", message: "", }); const [submitting, setSubmitting] = useState(false); const handleChange = (e: React.ChangeEvent) => { setForm({ ...form, [e.target.id]: e.target.value }); }; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setSubmitting(true); try { const res = await fetch(`${apiBase}/api/contact`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(form), }); if (!res.ok) throw new Error("Fehler beim Senden der Nachricht"); toast.success("Nachricht erfolgreich gesendet!"); setForm({ firstName: "", lastName: "", email: "", subject: "", message: "" }); } catch (err) { console.error(err); toast.error("Fehler beim Senden der Nachricht"); } finally { setSubmitting(false); } }; return (

Kontakt

Wir freuen uns auf deine Nachricht