mirror of
https://github.com/Jellify-Music/App.git
synced 2026-01-29 06:28:39 -06:00
fix build
This commit is contained in:
@@ -11,7 +11,5 @@ export const usePublicApi = (serverUrl: string) => useQuery({
|
||||
|
||||
export const useApi = () => useQuery({
|
||||
queryKey: [QueryKeys.Api],
|
||||
queryFn: async () => {
|
||||
return createApi;
|
||||
}
|
||||
queryFn: createApi
|
||||
})
|
||||
@@ -7,7 +7,7 @@ import _ from "lodash";
|
||||
* A promise to build an authenticated Jellyfin API client
|
||||
* @returns A Promise of the authenticated Jellyfin API client or a rejection
|
||||
*/
|
||||
export const createApi: Promise<Api> = new Promise(async (resolve, reject) => {
|
||||
export const createApi: () => Promise<Api> = () => new Promise(async (resolve, reject) => {
|
||||
return fetchCredentials()
|
||||
.then(credentials => {
|
||||
|
||||
|
||||
@@ -3,13 +3,14 @@ import { QueryKeys } from "../../enums/query-keys";
|
||||
import { getImageApi } from "@jellyfin/sdk/lib/utils/api/image-api"
|
||||
import { useApi } from "../queries";
|
||||
import { ImageType } from "@jellyfin/sdk/lib/generated-client/models";
|
||||
import { createApi } from "./functions/api";
|
||||
|
||||
|
||||
export const useImageByItemId = (itemId: string, imageType: ImageType) => useQuery({
|
||||
queryKey: [QueryKeys.ImageByItemId, itemId],
|
||||
queryFn: (async ({ queryKey }) => {
|
||||
|
||||
let imageFile = await getImageApi(useApi.data!)
|
||||
let imageFile = await getImageApi(await createApi())
|
||||
.getItemImage({ itemId: queryKey[1], imageType: imageType })
|
||||
.then((response) => {
|
||||
// This should be returning a File per Jellyfin's docs
|
||||
|
||||
@@ -2,11 +2,12 @@ import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useApi } from "../queries";
|
||||
import { QueryKeys } from "../../enums/query-keys";
|
||||
import { createApi } from "./functions/api";
|
||||
|
||||
export const useChildrenFromParent = (queryKey: QueryKeys, parentId: string) => useQuery({
|
||||
queryKey: [queryKey, parentId],
|
||||
queryFn: (({ queryKey }) => {
|
||||
return getItemsApi(useApi.data!)
|
||||
queryFn: (async ({ queryKey }) => {
|
||||
return getItemsApi(await createApi())
|
||||
.getItems({ parentId: queryKey[1] })
|
||||
.then((result) => {
|
||||
// If our response is empty or null, return empty array
|
||||
|
||||
@@ -12,7 +12,7 @@ import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models/base-item
|
||||
import { Api } from "@jellyfin/sdk";
|
||||
import { fetchMusicLibraries } from "../../../api/queries/functions/libraries";
|
||||
import { QueryKeys } from "../../../enums/query-keys";
|
||||
import { Icon } from "react-native-vector-icons/Icon";
|
||||
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
|
||||
|
||||
export default function ServerLibrary(): React.JSX.Element {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user