/** * 관리자 API 호출 유틸 — JWT 전용. * 로그인 후 localStorage의 access token을 Authorization 헤더에 설정한다. */ export function getAdminToken(): string { if (typeof window === 'undefined') return ''; return localStorage.getItem('hanarang_access_token') ?? ''; } export function adminFetch(path: string, options?: RequestInit) { const token = getAdminToken(); const headers: Record = { 'Content-Type': 'application/json', ...(options?.headers as Record ?? {}), ...(token ? { Authorization: `Bearer ${token}` } : {}), }; return fetch(path, { ...options, headers }); }