serverApi.tsx 364 B

1234567891011121314
  1. const BASE_ENDPOINT = 'http://dev.getsentry.net:8000/api/0';
  2. export async function fetchData(request, url, options = undefined) {
  3. const res = await fetch(BASE_ENDPOINT + url, {
  4. headers: {
  5. cookie: request.headers.get('cookie') || '',
  6. },
  7. ...(options || {}),
  8. });
  9. if (!res.ok) {
  10. throw new Error(res.statusText);
  11. }
  12. return res.json();
  13. }