mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Update mui based layout ui
This commit is contained in:
parent
bfbdffdff5
commit
4e7f0136f7
14 changed files with 163 additions and 194 deletions
23
src/hooks/useSystemInfo.ts
Normal file
23
src/hooks/useSystemInfo.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { useQuery } from '@tanstack/react-query';
|
||||
import type { Api } from '@jellyfin/sdk';
|
||||
import { getSystemApi } from '@jellyfin/sdk/lib/utils/api/system-api';
|
||||
import type { AxiosRequestConfig } from 'axios';
|
||||
|
||||
const fetchSystemInfo = async (
|
||||
api: Api | undefined,
|
||||
options: AxiosRequestConfig
|
||||
) => {
|
||||
if (!api) throw new Error('No API instance available');
|
||||
|
||||
const response = await getSystemApi(api)
|
||||
.getSystemInfo(options);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const useSystemInfo = (api: Api | undefined) => {
|
||||
return useQuery({
|
||||
queryKey: [ 'SystemInfo' ],
|
||||
queryFn: ({ signal }) => fetchSystemInfo(api, { signal }),
|
||||
enabled: !!api
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue