"use client"; export async function downloadExport(): Promise { const res = await fetch("/api/export"); if (!res.ok) throw new Error(`Export failed: ${res.status}`); const blob = await res.blob(); const url = URL.createObjectURL(blob); const a = document.createElement("a"); a.href = url; a.download = `export-${new Date().toISOString().slice(0, 10)}.json`; document.body.appendChild(a); a.click(); a.remove(); URL.revokeObjectURL(url); }