import { buildApiUrl, toUserFacingApiError } from './apiBase' async function request(path, token) { const response = await fetch(buildApiUrl(path), { headers: { Authorization: `Bearer ${token}`, }, }) const data = await response.json().catch(() => ({})) if (!response.ok) { throw new Error(toUserFacingApiError(data, '관리자 데이터를 불러오지 못했습니다.')) } return data } export async function fetchAdminOverview(token) { return request('/api/admin/overview', token) }