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

Refactor queries to use non-null assert

This commit is contained in:
viown 2025-02-25 17:18:50 +03:00
parent 3df39d659c
commit 2ce9e9f1e0
28 changed files with 47 additions and 127 deletions

View file

@ -6,14 +6,9 @@ import type { AxiosRequestConfig } from 'axios';
import { useApi } from './useApi';
const fetchSyncPlayGroups = async (
api?: Api,
api: Api,
options?: AxiosRequestConfig
) => {
if (!api) {
console.warn('[fetchSyncPlayGroups] No API instance available');
return;
}
const response = await getSyncPlayApi(api)
.syncPlayGetGroups(options);
return response.data;
@ -23,7 +18,7 @@ export const useSyncPlayGroups = () => {
const { api } = useApi();
return useQuery({
queryKey: [ 'SyncPlay', 'Groups' ],
queryFn: ({ signal }) => fetchSyncPlayGroups(api, { signal }),
queryFn: ({ signal }) => fetchSyncPlayGroups(api!, { signal }),
enabled: !!api
});
};