From 9952b39044070f471024437777bfaa7bfc92e117 Mon Sep 17 00:00:00 2001 From: Lei Nelissen Date: Sun, 21 Jul 2024 22:37:42 +0200 Subject: [PATCH] chore: fix typescript api call overload --- src/utility/JellyfinApi/lib.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utility/JellyfinApi/lib.ts b/src/utility/JellyfinApi/lib.ts index 4a0c4c8..8e30ac2 100644 --- a/src/utility/JellyfinApi/lib.ts +++ b/src/utility/JellyfinApi/lib.ts @@ -19,12 +19,16 @@ export function asyncFetchStore() { return require('@/store').default as Store; } +export type PathOrCredentialInserter = string | ((credentials: NonNullable) => string); + /** * A convenience function that accepts a request for fetch, injects it with the * proper Jellyfin credentials and attempts to catch any errors along the way. */ +export async function fetchApi(path: PathOrCredentialInserter, providedConfig?: RequestInit, parseResponse?: true): Promise; +export async function fetchApi(path: PathOrCredentialInserter, providedConfig: RequestInit, parseResponse: false): Promise; export async function fetchApi( - path: string | ((credentials: NonNullable) => string), + path: PathOrCredentialInserter, providedConfig?: RequestInit, parseResponse = true ) {