mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
25 lines
679 B
TypeScript
25 lines
679 B
TypeScript
import { Api } from '@jellyfin/sdk';
|
|
import { getConfigurationApi } from '@jellyfin/sdk/lib/utils/api/configuration-api';
|
|
import { useQuery } from '@tanstack/react-query';
|
|
import { useApi } from 'hooks/useApi';
|
|
|
|
export const fetchLogOptions = async (api?: Api) => {
|
|
if (!api) {
|
|
console.error('[useLogOptions] No API instance available');
|
|
return;
|
|
}
|
|
|
|
const response = await getConfigurationApi(api).getConfiguration();
|
|
|
|
return response.data;
|
|
};
|
|
|
|
export const useLogOptions = () => {
|
|
const { api } = useApi();
|
|
|
|
return useQuery({
|
|
queryKey: ['LogOptions'],
|
|
queryFn: () => fetchLogOptions(api),
|
|
enabled: !!api
|
|
});
|
|
};
|