"use client"; import useSWR from "swr"; const fetcher = (url: string) => fetch(url).then((r) => r.json()); export default function CouponsPage() { const { data, mutate } = useSWR<{ coupons: { id: string; code: string; title: string; description?: string; stock: number; maxPerUser: number; expiresAt?: string; used: number }[] }>("/api/coupons", fetcher); async function redeem(code: string) { await fetch("/api/coupons/redeem", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ code }) }); mutate(); } return (