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

Rename to useServerLogs

This commit is contained in:
viown 2025-01-14 01:07:56 +03:00
parent e08de5175d
commit da31c9856c
2 changed files with 5 additions and 5 deletions

View file

@ -0,0 +1,26 @@
import { Api } from '@jellyfin/sdk';
import { getSystemApi } from '@jellyfin/sdk/lib/utils/api/system-api';
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('[useLogEntries] No API instance available');
return;
}
const response = await getSystemApi(api).getServerLogs(options);
return response.data;
};
export const useServerLogs = () => {
const { api } = useApi();
return useQuery({
queryKey: [ 'LogEntries' ],
queryFn: ({ signal }) => fetchServerLogs(api, { signal }),
enabled: !!api
});
};