Skip to content

Commit

Permalink
Remove unused authAjaxUser
Browse files Browse the repository at this point in the history
  • Loading branch information
3flex committed Nov 10, 2024
1 parent b718e31 commit 07e11ad
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
27 changes: 0 additions & 27 deletions src/components/__tests__/jellyfinApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,33 +173,6 @@ describe('test authenticated ajax', () => {
});
});

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();
Expand Down
23 changes: 0 additions & 23 deletions src/components/jellyfinApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,27 +214,4 @@ export abstract class JellyfinApi {

return ajax({ ...params, ...args });
}

// Authenticated ajax
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public static authAjaxUser(path: string, args: any): Promise<any> {
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 });
}
}

0 comments on commit 07e11ad

Please sign in to comment.