"use client"; import useSWR from "swr"; import { useState } from "react"; const fetcher = (url: string) => fetch(url).then((r) => r.json()); export default function AdminBoardsPage() { const { data, mutate } = useSWR<{ boards: any[] }>("/api/admin/boards", fetcher); const boards = data?.boards ?? []; const [savingId, setSavingId] = useState(null); async function save(b: any) { setSavingId(b.id); await fetch(`/api/admin/boards/${b.id}`, { method: "PATCH", headers: { "content-type": "application/json" }, body: JSON.stringify(b) }); setSavingId(null); mutate(); } return (

게시판 설정

{boards.map((b) => ( ))}
이름 slug 읽기 쓰기 익명 비밀댓 승인 유형 성인 정렬
); } function Row({ b, onSave, saving }: { b: any; onSave: (b: any) => void; saving: boolean }) { const [edit, setEdit] = useState(b); return ( setEdit({ ...edit, name: e.target.value })} /> setEdit({ ...edit, slug: e.target.value })} /> setEdit({ ...edit, allowAnonymousPost: e.target.checked })} /> setEdit({ ...edit, allowSecretComment: e.target.checked })} /> setEdit({ ...edit, requiresApproval: e.target.checked })} /> setEdit({ ...edit, isAdultOnly: e.target.checked })} /> setEdit({ ...edit, sortOrder: Number(e.target.value) })} style={{ width: 80 }} /> ); }