()
| 584 | } |
| 585 | |
| 586 | function adminHeaders(){ |
| 587 | return { 'Content-Type': 'application/json', 'Authorization': `Bearer ${S.admin.token}` }; |
| 588 | } |
| 589 | async function api(path, options = {}){ |
| 590 | const res = await fetch(path, { ...options, headers: { ...(options.headers || {}), ...(options.auth === false ? {} : adminHeaders()) } }); |
| 591 | const data = await res.json().catch(() => ({})); |