Skip to content

Commit

Permalink
Migrate getUser to jellyfin-sdk-typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
3flex committed Nov 10, 2024
1 parent f177c26 commit 09154ad
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
TvShowsApiGetEpisodesRequest,
UserDto
} from '@jellyfin/sdk/lib/generated-client';
import { getTvShowsApi } from '@jellyfin/sdk/lib/utils/api';
import { getTvShowsApi, getUserApi } from '@jellyfin/sdk/lib/utils/api';
import { JellyfinApi } from './components/jellyfinApi';
import { PlaybackManager, PlaybackState } from './components/playbackManager';
import { BusMessage, ItemQuery } from './types/global';
Expand Down Expand Up @@ -613,11 +613,10 @@ export function getIntros(
* Get user object for the current user
* @returns user object
*/
export function getUser(): Promise<UserDto> {
return JellyfinApi.authAjaxUser('', {
dataType: 'json',
type: 'GET'
});
export async function getUser(): Promise<UserDto> {
const response = await getUserApi(JellyfinApi.jellyfinApi).getCurrentUser();

return response.data;
}

/**
Expand Down

0 comments on commit 09154ad

Please sign in to comment.