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:
parent
3df39d659c
commit
2ce9e9f1e0
28 changed files with 47 additions and 127 deletions
|
@ -4,13 +4,8 @@ import { useQuery } from '@tanstack/react-query';
|
|||
import { useApi } from 'hooks/useApi';
|
||||
import type { AxiosRequestConfig } from 'axios';
|
||||
|
||||
const fetchServerLogs = async (api?: Api, options?: AxiosRequestConfig) => {
|
||||
if (!api) {
|
||||
console.error('[useServerLogs] No API instance available');
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await getSystemApi(api).getServerLogs(options);
|
||||
const fetchServerLogs = async (api: Api, options?: AxiosRequestConfig) => {
|
||||
const response = await getSystemApi(api!).getServerLogs(options);
|
||||
|
||||
return response.data;
|
||||
};
|
||||
|
@ -20,7 +15,7 @@ export const useServerLogs = () => {
|
|||
|
||||
return useQuery({
|
||||
queryKey: [ 'ServerLogs' ],
|
||||
queryFn: ({ signal }) => fetchServerLogs(api, { signal }),
|
||||
queryFn: ({ signal }) => fetchServerLogs(api!, { signal }),
|
||||
enabled: !!api
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue