auth-runtime/dist/http.js

26 lines
622 B
JavaScript
Raw Permalink Normal View History

2026-03-11 23:33:43 +00:00
/**
* Make HTTP request to API
*/
export async function requestApi(method, url, authToken, body, extraHeaders) {
2026-03-11 23:33:43 +00:00
const headers = {
'Content-Type': 'application/json',
...extraHeaders,
2026-03-11 23:33:43 +00:00
};
if (authToken) {
headers['Authorization'] = `Bearer ${authToken}`;
}
const options = {
method,
headers,
};
if (body) {
options.body = body;
}
const response = await fetch(url, options);
const responseBody = await response.text();
return {
status: response.status,
body: responseBody,
};
}
//# sourceMappingURL=http.js.map