"use client";

import { useEffect, useState } from "react";
import { api } from "@/lib/api";
import type { StandardQAItem } from "@/lib/types";
import StandardQATable from "@/components/StandardQATable";

export default function StandardQAPage() {
  const [items, setItems] = useState<StandardQAItem[]>([]);

  async function load() {
    const data = await api.get<StandardQAItem[]>("/standard-qa");
    setItems(data);
  }

  useEffect(() => {
    load();
  }, []);

  return (
    <div className="space-y-6">
      <div>
        <h1 className="text-2xl font-semibold text-ink">标准问答库</h1>
      </div>
      <StandardQATable items={items} onChanged={load} />
    </div>
  );
}

