mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Refactor queries to use non-null assert
This commit is contained in:
parent
3df39d659c
commit
2ce9e9f1e0
28 changed files with 47 additions and 127 deletions
|
@ -8,14 +8,9 @@ import { useApi } from 'hooks/useApi';
|
|||
export const QUERY_KEY = 'BrandingOptions';
|
||||
|
||||
const fetchBrandingOptions = async (
|
||||
api?: Api,
|
||||
api: Api,
|
||||
options?: AxiosRequestConfig
|
||||
) => {
|
||||
if (!api) {
|
||||
console.error('[fetchBrandingOptions] no Api instance provided');
|
||||
throw new Error('No Api instance provided to fetchBrandingOptions');
|
||||
}
|
||||
|
||||
return getBrandingApi(api)
|
||||
.getBrandingOptions(options)
|
||||
.then(({ data }) => data);
|
||||
|
@ -25,7 +20,7 @@ export const getBrandingOptionsQuery = (
|
|||
api?: Api
|
||||
) => queryOptions({
|
||||
queryKey: [ QUERY_KEY ],
|
||||
queryFn: ({ signal }) => fetchBrandingOptions(api, { signal }),
|
||||
queryFn: ({ signal }) => fetchBrandingOptions(api!, { signal }),
|
||||
enabled: !!api
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue