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:
parent
e08de5175d
commit
da31c9856c
2 changed files with 5 additions and 5 deletions
26
src/apps/dashboard/features/logs/api/useServerLogs.ts
Normal file
26
src/apps/dashboard/features/logs/api/useServerLogs.ts
Normal 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
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue