diff --git a/src/components/__tests__/jellyfinApi.test.ts b/src/components/__tests__/jellyfinApi.test.ts index 83277877..933f00af 100644 --- a/src/components/__tests__/jellyfinApi.test.ts +++ b/src/components/__tests__/jellyfinApi.test.ts @@ -142,33 +142,6 @@ describe('creating image urls', () => { }); }); -describe('test authenticated user ajax', () => { - test('should return rejected promise when server info is undefined', async () => { - // Linting requires this weird spacing. - JellyfinApi.setServerInfo(undefined, '', ''); - - const resultUserIdIsNull = JellyfinApi.authAjaxUser('', {}); - - JellyfinApi.setServerInfo('', undefined, ''); - - const resultAccessTokenIsNull = JellyfinApi.authAjaxUser('', {}); - - JellyfinApi.setServerInfo('', ''); - - const resultServerAddressIsNull = JellyfinApi.authAjaxUser('', {}); - - await expect(resultUserIdIsNull).rejects.toEqual( - 'no server info present' - ); - await expect(resultAccessTokenIsNull).rejects.toEqual( - 'no server info present' - ); - await expect(resultServerAddressIsNull).rejects.toEqual( - 'no server info present' - ); - }); -}); - describe('getting security headers', () => { beforeAll(() => { setupMockCastSenders(); diff --git a/src/components/jellyfinApi.ts b/src/components/jellyfinApi.ts index 52fb40f9..a7b5a488 100644 --- a/src/components/jellyfinApi.ts +++ b/src/components/jellyfinApi.ts @@ -1,7 +1,6 @@ import { Api, Jellyfin } from '@jellyfin/sdk'; import axios from 'axios'; import { version as packageVersion } from '../../package.json'; -import { ajax } from './fetchhelper'; axios.interceptors.request.use((request) => { console.log(`requesting url: ${request.url}`); @@ -191,27 +190,4 @@ export abstract class JellyfinApi { `Items/${itemId}/Images/${imgType}/${imgIdx.toString()}?tag=${imgTag}` ); } - - // Authenticated ajax - // eslint-disable-next-line @typescript-eslint/no-explicit-any - public static authAjaxUser(path: string, args: any): Promise { - if ( - this.userId === undefined || - this.accessToken === undefined || - this.serverAddress === undefined - ) { - console.error( - 'JellyfinApi.authAjaxUser: No userid/accesstoken/serverAddress present. Skipping request' - ); - - return Promise.reject('no server info present'); - } - - const params = { - headers: this.getSecurityHeaders(), - url: this.createUserUrl(path) - }; - - return ajax({ ...params, ...args }); - } }