diff --git a/src/logic/utils/http-utils.ts b/src/logic/utils/http-utils.ts index e40f8a5..334802b 100644 --- a/src/logic/utils/http-utils.ts +++ b/src/logic/utils/http-utils.ts @@ -28,4 +28,25 @@ export class HttpUtils .catch(reject) }); } + + public get(url: string): Promise + { + // Create promise + return new Promise((resolve, reject) => + { + // Fetch request + fetch(url, {method: 'GET'}).then(res => + { + // Get response body text + res.text().then(text => + { + // Parse response + let response = JSON.parse(text); + resolve(response); + }) + .catch(reject) + }) + .catch(reject) + }); + } }