aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/services/fetchWithCheck.ts
blob: e84e8b61dc73915a34b762b84f8e0329776eafbc (plain)
1
2
3
4
5
6
7
export default class FetchWithCheck {
  static async get(url: RequestInfo): Promise<Response> {
    const response = await fetch(url);
    if (!response.ok) throw new Error(`${response.status}: ${response.statusText}`);
    return response;
  }
}