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

apply suggestion

Co-authored-by: Bill Thornton <thornbill@users.noreply.github.com>
This commit is contained in:
grafixeyehero 2024-09-24 04:15:12 +03:00
parent 1c18fa8fb2
commit c5bbd5bca9
9 changed files with 64 additions and 63 deletions

View file

@ -10,8 +10,9 @@ const getChannel = async (
options?: AxiosRequestConfig
) => {
const { api, user } = apiContext;
if (!api) throw new Error('No API instance available');
if (!user?.Id) throw new Error('No User ID provided');
if (!api) throw new Error('[getChannel] No API instance available');
if (!user?.Id) throw new Error('[getChannel] No User ID provided');
const response = await getLiveTvApi(api).getChannel(
{
@ -26,15 +27,15 @@ const getChannel = async (
export const getChannelQuery = (
apiContext: JellyfinApiContext,
params: LiveTvApiGetChannelRequest
) => queryOptions({
queryKey: ['Channel', params.channelId],
queryFn: ({ signal }) => getChannel(apiContext, params, { signal }),
enabled: !!apiContext.api && !!apiContext.user?.Id && !!params.channelId
});
) =>
queryOptions({
queryKey: ['Channel', params.channelId],
queryFn: ({ signal }) => getChannel(apiContext, params, { signal }),
enabled:
!!apiContext.api && !!apiContext.user?.Id && !!params.channelId
});
export const useGetChannel = (
params: LiveTvApiGetChannelRequest
) => {
export const useGetChannel = (params: LiveTvApiGetChannelRequest) => {
const apiContext = useApi();
return useQuery(getChannelQuery(apiContext, params));
};