Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused authAjax function #695

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions src/components/__tests__/jellyfinApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,37 +142,6 @@ describe('creating image urls', () => {
});
});

describe('test authenticated ajax', () => {
beforeAll(() => {
setupMockCastSenders();
});

test('should return rejected promise when server info is undefined', async () => {
// Linting requires this weird spacing.
JellyfinApi.setServerInfo(undefined, '', '');

const resultUserIdIsNull = JellyfinApi.authAjax('', {});

JellyfinApi.setServerInfo('', undefined, '');

const resultAccessTokenIsNull = JellyfinApi.authAjax('', {});

JellyfinApi.setServerInfo('', '', undefined);

const resultServerAddressIsNull = JellyfinApi.authAjax('', {});

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('test authenticated user ajax', () => {
test('should return rejected promise when server info is undefined', async () => {
// Linting requires this weird spacing.
Expand Down
23 changes: 0 additions & 23 deletions src/components/jellyfinApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,29 +192,6 @@ export abstract class JellyfinApi {
);
}

// Authenticated ajax
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public static authAjax(path: string, args: any): Promise<any> {
if (
this.userId === undefined ||
this.accessToken === undefined ||
this.serverAddress === undefined
) {
console.error(
'JellyfinApi.authAjax: No userid/accesstoken/serverAddress present. Skipping request'
);

return Promise.reject('no server info present');
}

const params = {
headers: this.getSecurityHeaders(),
url: this.createUrl(path)
};

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

// Authenticated ajax
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public static authAjaxUser(path: string, args: any): Promise<any> {
Expand Down
Loading