1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Refactor api hooks

This commit is contained in:
Bill Thornton 2022-11-18 12:55:46 -05:00
parent 331f05b77d
commit c8ea7322fd
6 changed files with 80 additions and 61 deletions

View file

@ -7,7 +7,6 @@ import React, { FunctionComponent, useEffect, useState } from 'react';
import { appRouter } from '../appRouter';
import { useApi } from '../../hooks/useApi';
import { useUser } from '../../hooks/useUser';
import globalize from '../../scripts/globalize';
import '../../elements/emby-button/emby-button';
@ -30,8 +29,7 @@ type SearchSuggestionsProps = {
const SearchSuggestions: FunctionComponent<SearchSuggestionsProps> = ({ parentId }: SearchSuggestionsProps) => {
const [ suggestions, setSuggestions ] = useState<BaseItemDto[]>([]);
const api = useApi();
const user = useUser();
const { api, user } = useApi();
useEffect(() => {
if (api && user?.Id) {
@ -49,7 +47,7 @@ const SearchSuggestions: FunctionComponent<SearchSuggestionsProps> = ({ parentId
})
.then(result => setSuggestions(result.data.Items || []));
}
}, [api, parentId, user?.Id]);
}, [ api, parentId, user ]);
return (
<div