cic-staff-client/src/app/_helpers/http-getter.ts

20 lines
407 B
TypeScript
Raw Normal View History

class HttpGetter {
async get(filename: string): Promise<any> {
const xhr = new XMLHttpRequest();
xhr.addEventListener('load', (e) => {
if (xhr.status === 200) {
console.log(xhr.responseText);
return;
}
console.log('failed with status ' + xhr.status + ': ' + xhr.statusText);
});
xhr.open('GET', filename);
xhr.send();
}
}
export {
HttpGetter
};