"use client"; import { useState } from "react"; export function TestButtons() { const [mail, setMail] = useState("test@example.de"); const [chatId, setChatId] = useState(""); const [result, setResult] = useState(""); async function testMail() { setResult("…"); const res = await fetch("/api/settings/test-mail", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ to: mail }), }); const data = await res.json().catch(() => ({})); setResult(res.ok ? "Test-Mail versendet." : `Fehler: ${data.error ?? res.status}`); } async function testTelegram() { setResult("…"); const res = await fetch("/api/settings/test-telegram", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ chatId }), }); const data = await res.json().catch(() => ({})); setResult(res.ok ? "Test-Telegram versendet." : `Fehler: ${data.error ?? res.status}`); } return (

Versand testen

setMail(e.target.value)} className="mt-1.5 h-11 w-full rounded-field border border-line bg-white px-3.5 text-sm text-ink" />
setChatId(e.target.value)} className="mt-1.5 h-11 w-full rounded-field border border-line bg-white px-3.5 text-sm text-ink" />
{result &&

{result}

}
); }