mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
21 lines
652 B
TypeScript
21 lines
652 B
TypeScript
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) => {
|
|
const response = await getSystemApi(api!).getServerLogs(options);
|
|
|
|
return response.data;
|
|
};
|
|
|
|
export const useServerLogs = () => {
|
|
const { api } = useApi();
|
|
|
|
return useQuery({
|
|
queryKey: [ 'ServerLogs' ],
|
|
queryFn: ({ signal }) => fetchServerLogs(api!, { signal }),
|
|
enabled: !!api
|
|
});
|
|
};
|