mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add key to named configuration hook
This commit is contained in:
parent
1ab2197200
commit
7713e31b44
3 changed files with 11 additions and 9 deletions
|
@ -16,7 +16,7 @@ export const useConfiguration = () => {
|
|||
const { api } = useApi();
|
||||
|
||||
return useQuery({
|
||||
queryKey: [QUERY_KEY],
|
||||
queryKey: [ QUERY_KEY ],
|
||||
queryFn: ({ signal }) => fetchConfiguration(api!, { signal }),
|
||||
enabled: !!api
|
||||
});
|
||||
|
|
|
@ -6,11 +6,11 @@ import type { AxiosRequestConfig } from 'axios';
|
|||
|
||||
export const QUERY_KEY = 'NamedConfiguration';
|
||||
|
||||
interface NamedConfiguration {
|
||||
export interface NamedConfiguration {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export const fetchNamedConfiguration = async (api: Api, key: string, options?: AxiosRequestConfig) => {
|
||||
const fetchNamedConfiguration = async (api: Api, key: string, options?: AxiosRequestConfig) => {
|
||||
const response = await getConfigurationApi(api).getNamedConfiguration({ key }, options);
|
||||
|
||||
return response.data as unknown as NamedConfiguration;
|
||||
|
@ -20,7 +20,7 @@ export const useNamedConfiguration = (key: string) => {
|
|||
const { api } = useApi();
|
||||
|
||||
return useQuery({
|
||||
queryKey: [ QUERY_KEY ],
|
||||
queryKey: [ QUERY_KEY, key ],
|
||||
queryFn: ({ signal }) => fetchNamedConfiguration(api!, key, { signal }),
|
||||
enabled: !!api
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue