mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2026-11-10 16:16:49 +00:00
26 lines
826 B
TypeScript
26 lines
826 B
TypeScript
import { getAuthenticationApi } from '@jellyfin/sdk/lib/utils/api/authentication-api';
|
|
import { useQuery } from '@tanstack/react-query';
|
|
import type { AxiosRequestConfig } from 'axios';
|
|
|
|
import { type JellyfinApiContext, useApi } from './useApi';
|
|
|
|
const fetchQuickConnectEnabled = async (
|
|
apiContext: JellyfinApiContext,
|
|
options?: AxiosRequestConfig
|
|
) => {
|
|
const { api } = apiContext;
|
|
if (!api) throw new Error('No API instance available');
|
|
|
|
const response = await getAuthenticationApi(api)
|
|
.getQuickConnectEnabled(options);
|
|
return response.data;
|
|
};
|
|
|
|
export const useQuickConnectEnabled = () => {
|
|
const currentApi = useApi();
|
|
return useQuery({
|
|
queryKey: [ 'QuickConnect', 'Enabled' ],
|
|
queryFn: ({ signal }) => fetchQuickConnectEnabled(currentApi, { signal })
|
|
});
|
|
};
|