mirror of
https://github.com/jellyfin/jellyfin-chromecast.git
synced 2024-11-23 14:09:58 +00:00
Migrate getItemsForPlayback to jellyfin-sdk-typescript
This commit is contained in:
parent
d8eee5d989
commit
bfee74f006
@ -14,7 +14,11 @@ import type {
|
|||||||
ItemFields,
|
ItemFields,
|
||||||
ItemsApiGetItemsRequest
|
ItemsApiGetItemsRequest
|
||||||
} from '@jellyfin/sdk/lib/generated-client';
|
} from '@jellyfin/sdk/lib/generated-client';
|
||||||
import { getInstantMixApi, getTvShowsApi } from '@jellyfin/sdk/lib/utils/api';
|
import {
|
||||||
|
getInstantMixApi,
|
||||||
|
getItemsApi,
|
||||||
|
getTvShowsApi
|
||||||
|
} from '@jellyfin/sdk/lib/utils/api';
|
||||||
import { JellyfinApi } from './components/jellyfinApi';
|
import { JellyfinApi } from './components/jellyfinApi';
|
||||||
import { PlaybackManager, PlaybackState } from './components/playbackManager';
|
import { PlaybackManager, PlaybackState } from './components/playbackManager';
|
||||||
import { BusMessage } from './types/global';
|
import { BusMessage } from './types/global';
|
||||||
@ -577,21 +581,18 @@ export async function getItemsForPlayback(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (query.ids?.length == 1) {
|
if (query.ids?.length == 1) {
|
||||||
const item = await JellyfinApi.authAjaxUser(`Items/${query.ids[0]}`, {
|
const response = await getItemsApi(JellyfinApi.jellyfinApi).getItems({
|
||||||
dataType: 'json',
|
...query,
|
||||||
type: 'GET'
|
...params
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return response.data;
|
||||||
Items: [item],
|
|
||||||
TotalRecordCount: 1
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
return JellyfinApi.authAjaxUser('Items', {
|
const response = await getItemsApi(JellyfinApi.jellyfinApi).getItems(
|
||||||
dataType: 'json',
|
query
|
||||||
query: { ...query, ...params },
|
);
|
||||||
type: 'GET'
|
|
||||||
});
|
return response.data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user