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 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 = {
|
||||
serverId?: string;
|
||||
parentId?: string | null;
|
||||
|
@ -67,7 +86,7 @@ const SearchResults: FC<SearchResultsProps> = ({ serverId = window.ApiClient.ser
|
|||
IncludeArtists: false
|
||||
}), [ parentId, debouncedQuery ]);
|
||||
|
||||
const fetchArtists = useCallback((apiClient: ApiClient, params = {}) => (
|
||||
const fetchArtists = useCallback((apiClient: ApiClient, params: ParametersOptions = {}) => (
|
||||
apiClient?.getArtists(
|
||||
apiClient.getCurrentUserId(),
|
||||
{
|
||||
|
@ -78,7 +97,7 @@ const SearchResults: FC<SearchResultsProps> = ({ serverId = window.ApiClient.ser
|
|||
).then(ensureNonNullItems)
|
||||
), [getDefaultParameters]);
|
||||
|
||||
const fetchItems = useCallback(async (apiClient?: ApiClient, params = {}) => {
|
||||
const fetchItems = useCallback(async (apiClient?: ApiClient, params: ParametersOptions = {}) => {
|
||||
if (!apiClient) {
|
||||
console.error('[SearchResults] no apiClient; unable to fetch items');
|
||||
return {
|
||||
|
@ -86,7 +105,7 @@ const SearchResults: FC<SearchResultsProps> = ({ serverId = window.ApiClient.ser
|
|||
};
|
||||
}
|
||||
|
||||
const options = {
|
||||
const options: ParametersOptions = {
|
||||
...getDefaultParameters(),
|
||||
IncludeMedia: true,
|
||||
...params
|
||||
|
@ -105,7 +124,7 @@ const SearchResults: FC<SearchResultsProps> = ({ serverId = window.ApiClient.ser
|
|||
).then(ensureNonNullItems);
|
||||
}, [getDefaultParameters]);
|
||||
|
||||
const fetchPeople = useCallback((apiClient: ApiClient, params = {}) => (
|
||||
const fetchPeople = useCallback((apiClient: ApiClient, params: ParametersOptions = {}) => (
|
||||
apiClient?.getPeople(
|
||||
apiClient.getCurrentUserId(),
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue