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]); - } -}