import { rejectBody } from '@app/_helpers/global-error-handler';

function HttpGetter(): void {}

HttpGetter.prototype.get = (filename) =>
  new Promise((resolve, reject) => {
    fetch(filename).then((response) => {
      if (response.ok) {
        resolve(response.text());
      } else {
        reject(rejectBody(response));
      }
      return;
    });
  });

export { HttpGetter };
