(timestamp)
| 19113 | |
| 19114 | async function postAPI(endpoint, data) { |
| 19115 | try { |
| 19116 | const response = await networkAwareFetch(endpoint, { |
| 19117 | method: 'POST', |
| 19118 | headers: { |
| 19119 | 'Content-Type': 'application/json', |
| 19120 | }, |
| 19121 | body: JSON.stringify(data) |
| 19122 | }); |
| 19123 | if (response.status === 401) { |
| 19124 | window.location.href = '/login'; |
| 19125 | throw new Error('Authentication required'); |
| 19126 | } |
| 19127 | if (!response.ok) { |
| 19128 | throw errorFromResponse(response, await extractErrorBody(response)); |
| 19129 | } |
no outgoing calls
no test coverage detected