(url: string)
| 80 | /* ────── Helpers ────── */ |
| 81 | |
| 82 | const fetchJson = async <T,>(url: string): Promise<T> => { |
| 83 | const token = localStorage.getItem('token'); |
| 84 | const res = await fetch(url, { headers: token ? { Authorization: `Bearer ${token}` } : {} }); |
| 85 | if (!res.ok) throw new Error('Failed to fetch'); |
| 86 | return res.json(); |
| 87 | }; |
| 88 | |
| 89 | const postJson = async (url: string, body: any) => { |
| 90 | const token = localStorage.getItem('token'); |
no test coverage detected