"use client"; import { useState } from "react"; import Link from "next/link"; import { api } from "@/lib/api"; import { useAuth } from "@/lib/auth"; import { useToast } from "@/lib/toast"; import { useI18n } from "@/lib/i18n"; export default function FeedbackClient() { const { token } = useAuth(); const { toast } = useToast(); const { t } = useI18n(); const [content, setContent] = useState(""); const [category, setCategory] = useState("general"); const [loading, setLoading] = useState(false); const [done, setDone] = useState(false); const submit = async () => { if (!content.trim() || content.trim().length < 5) { toast("请至少写 5 个字", "info"); return; } setLoading(true); try { await api.submitFeedback(content.trim(), token || undefined, category); toast(t.feedback.ok, "success"); setContent(""); setDone(true); } catch { toast(t.feedback.fail, "error"); } finally { setLoading(false); } }; return (
{t.feedback.subtitle}
我们会认真阅读每一条反馈