From 4cfcd3c20d997abf0f8ec27e51e88fae2631a6fa Mon Sep 17 00:00:00 2001 From: "Miquel A. Cabot" Date: Thu, 9 Jun 2022 13:18:46 +0200 Subject: [PATCH] remove unused functions from FetchHelper --- src/utils/FetchHelper.ts | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/src/utils/FetchHelper.ts b/src/utils/FetchHelper.ts index a21cd181..64727d9d 100644 --- a/src/utils/FetchHelper.ts +++ b/src/utils/FetchHelper.ts @@ -1,16 +1,5 @@ import fetch from 'cross-fetch' import { DownloadResponse } from '../@types' -import { LoggerInstance } from '.' - -export async function fetchData(url: string, opts: RequestInit): Promise { - const result = await fetch(url, opts) - if (!result.ok) { - LoggerInstance.error(`Error requesting [${opts.method}] ${url}`) - LoggerInstance.error(`Response message: \n${await result.text()}`) - throw result - } - return result -} export async function downloadFileBrowser(url: string): Promise { const anchor = document.createElement('a') @@ -42,28 +31,3 @@ export async function downloadFile( return { data: await response.arrayBuffer(), filename } } - -async function postWithHeaders( - url: string, - payload: BodyInit, - headers: any -): Promise { - if (payload != null) { - return fetch(url, { - method: 'POST', - body: payload, - headers - }) - } else { - return fetch(url, { - method: 'POST' - }) - } -} - -export async function postData(url: string, payload: BodyInit): Promise { - const headers = { - 'Content-type': 'application/json' - } - return postWithHeaders(url, payload, headers) -}