From 256465e05b6a2d616658efeb19f993b24a91d2e2 Mon Sep 17 00:00:00 2001 From: ChaotiCryptidz Date: Sun, 23 Jan 2022 18:48:12 +0000 Subject: [PATCH] remove unused file --- src/api/apiUtils.ts | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 src/api/apiUtils.ts diff --git a/src/api/apiUtils.ts b/src/api/apiUtils.ts deleted file mode 100644 index b077f10..0000000 --- a/src/api/apiUtils.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { BaseAPIResponse } from "./types/api"; -import { DoesNotExistError } from "../types/internalErrors"; -import { settings } from "../globals/globalSettings"; - -export function getHeaders(): Record { - return { - "X-Vault-Token": settings.token, - }; -} - -export const appendAPIURL = (url: string): string => settings.apiURL + url; - -export async function checkResponse(resp: Response): Promise { - if (resp.ok) return; - if (resp.status == 404) throw DoesNotExistError; - - let json: BaseAPIResponse; - try { - json = (await resp.json()) as BaseAPIResponse; - } catch { - // Do Nothing - } - - if (json?.errors?.length >= 1) { - throw new Error(json.errors[0]); - } -}