mirror of
https://github.com/Jellify-Music/App.git
synced 2026-04-22 01:28:28 -05:00
841f9ab4cd
refactor album stuff so that it works for playlists since they're like the same
17 lines
644 B
TypeScript
17 lines
644 B
TypeScript
import { QueryKeys } from "@/enums/query-keys";
|
|
import { Api } from "@jellyfin/sdk";
|
|
import { useQuery } from "@tanstack/react-query";
|
|
import { fetchUserPlaylists } from "./functions/playlists";
|
|
|
|
export const useUserPlaylists = (api: Api, userId: string, playlistLibraryId: string) => useQuery({
|
|
queryKey: [QueryKeys.UserPlaylists, api, userId, playlistLibraryId],
|
|
queryFn: ({ queryKey }) => {
|
|
const api: Api = queryKey[1] as Api;
|
|
const userId: string = queryKey[2] as string;
|
|
const playlistLibraryId: string = queryKey[3] as string;
|
|
|
|
return fetchUserPlaylists(api, userId, playlistLibraryId);
|
|
}
|
|
})
|
|
|