remove unused file
This commit is contained in:
parent
35663d94eb
commit
256465e05b
|
@ -1,27 +0,0 @@
|
|||
import { BaseAPIResponse } from "./types/api";
|
||||
import { DoesNotExistError } from "../types/internalErrors";
|
||||
import { settings } from "../globals/globalSettings";
|
||||
|
||||
export function getHeaders(): Record<string, string> {
|
||||
return {
|
||||
"X-Vault-Token": settings.token,
|
||||
};
|
||||
}
|
||||
|
||||
export const appendAPIURL = (url: string): string => settings.apiURL + url;
|
||||
|
||||
export async function checkResponse(resp: Response): Promise<void> {
|
||||
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]);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue