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 ) {