8.1 출석부: 데일리 체크인/중복 방지/포인트 지급/누적 통계 o

This commit is contained in:
koreacomp5
2025-10-09 17:18:49 +09:00
parent 9ed65edf65
commit 089d73eb50
3 changed files with 46 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
"use client";
import useSWR from "swr";
const fetcher = (url: string) => fetch(url).then((r) => r.json());
export default function AttendancePage() {
const { data, mutate } = useSWR<{ today: boolean; count: number }>("/api/attendance", fetcher);
return (
<div>
<h1></h1>
<p> : {data?.today ? "✅" : "❌"} / : {data?.count ?? 0}</p>
<button disabled={data?.today} onClick={async () => { await fetch("/api/attendance", { method: "POST" }); mutate(); }}></button>
</div>
);
}