mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add Legacy params interface
This commit is contained in:
parent
06e585e2bc
commit
11393ac3b2
1 changed files with 23 additions and 4 deletions
|
@ -11,6 +11,25 @@ import ServerConnections from '../ServerConnections';
|
||||||
import SearchResultsRow from './SearchResultsRow';
|
import SearchResultsRow from './SearchResultsRow';
|
||||||
import Loading from '../loading/LoadingComponent';
|
import Loading from '../loading/LoadingComponent';
|
||||||
|
|
||||||
|
interface ParametersOptions {
|
||||||
|
ParentId?: string | null;
|
||||||
|
searchTerm?: string;
|
||||||
|
Limit?: number;
|
||||||
|
Fields?: string;
|
||||||
|
Recursive?: boolean;
|
||||||
|
EnableTotalRecordCount?: boolean;
|
||||||
|
ImageTypeLimit?: number;
|
||||||
|
IncludePeople?: boolean;
|
||||||
|
IncludeMedia?: boolean;
|
||||||
|
IncludeGenres?: boolean;
|
||||||
|
IncludeStudios?: boolean;
|
||||||
|
IncludeArtists?: boolean;
|
||||||
|
IsMissing?: boolean;
|
||||||
|
IncludeItemTypes?: BaseItemKind;
|
||||||
|
MediaTypes?: string;
|
||||||
|
ExcludeItemTypes?: string;
|
||||||
|
}
|
||||||
|
|
||||||
type SearchResultsProps = {
|
type SearchResultsProps = {
|
||||||
serverId?: string;
|
serverId?: string;
|
||||||
parentId?: string | null;
|
parentId?: string | null;
|
||||||
|
@ -67,7 +86,7 @@ const SearchResults: FC<SearchResultsProps> = ({ serverId = window.ApiClient.ser
|
||||||
IncludeArtists: false
|
IncludeArtists: false
|
||||||
}), [ parentId, debouncedQuery ]);
|
}), [ parentId, debouncedQuery ]);
|
||||||
|
|
||||||
const fetchArtists = useCallback((apiClient: ApiClient, params = {}) => (
|
const fetchArtists = useCallback((apiClient: ApiClient, params: ParametersOptions = {}) => (
|
||||||
apiClient?.getArtists(
|
apiClient?.getArtists(
|
||||||
apiClient.getCurrentUserId(),
|
apiClient.getCurrentUserId(),
|
||||||
{
|
{
|
||||||
|
@ -78,7 +97,7 @@ const SearchResults: FC<SearchResultsProps> = ({ serverId = window.ApiClient.ser
|
||||||
).then(ensureNonNullItems)
|
).then(ensureNonNullItems)
|
||||||
), [getDefaultParameters]);
|
), [getDefaultParameters]);
|
||||||
|
|
||||||
const fetchItems = useCallback(async (apiClient?: ApiClient, params = {}) => {
|
const fetchItems = useCallback(async (apiClient?: ApiClient, params: ParametersOptions = {}) => {
|
||||||
if (!apiClient) {
|
if (!apiClient) {
|
||||||
console.error('[SearchResults] no apiClient; unable to fetch items');
|
console.error('[SearchResults] no apiClient; unable to fetch items');
|
||||||
return {
|
return {
|
||||||
|
@ -86,7 +105,7 @@ const SearchResults: FC<SearchResultsProps> = ({ serverId = window.ApiClient.ser
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const options = {
|
const options: ParametersOptions = {
|
||||||
...getDefaultParameters(),
|
...getDefaultParameters(),
|
||||||
IncludeMedia: true,
|
IncludeMedia: true,
|
||||||
...params
|
...params
|
||||||
|
@ -105,7 +124,7 @@ const SearchResults: FC<SearchResultsProps> = ({ serverId = window.ApiClient.ser
|
||||||
).then(ensureNonNullItems);
|
).then(ensureNonNullItems);
|
||||||
}, [getDefaultParameters]);
|
}, [getDefaultParameters]);
|
||||||
|
|
||||||
const fetchPeople = useCallback((apiClient: ApiClient, params = {}) => (
|
const fetchPeople = useCallback((apiClient: ApiClient, params: ParametersOptions = {}) => (
|
||||||
apiClient?.getPeople(
|
apiClient?.getPeople(
|
||||||
apiClient.getCurrentUserId(),
|
apiClient.getCurrentUserId(),
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue