Add music folders query

This commit is contained in:
jeffvli 2022-12-20 19:11:33 -08:00
parent 3399fc6bf6
commit a354cab797
11 changed files with 143 additions and 55 deletions

View file

@ -95,11 +95,13 @@ const authenticate = async (
};
const getMusicFolderList = async (args: MusicFolderListArgs): Promise<JFMusicFolderList> => {
const { signal } = args;
const { server, signal } = args;
const userId = useAuthStore.getState().currentServer?.userId;
const data = await api
.get(`users/${userId}/items`, {
headers: { 'X-MediaBrowser-Token': server?.credential },
prefixUrl: server?.url,
signal,
})
.json<JFMusicFolderListResponse>();
@ -108,11 +110,7 @@ const getMusicFolderList = async (args: MusicFolderListArgs): Promise<JFMusicFol
(folder) => folder.CollectionType === JFCollectionType.MUSIC,
);
return {
items: musicFolders,
startIndex: data.StartIndex,
totalRecordCount: data.TotalRecordCount,
};
return musicFolders;
};
const getGenreList = async (args: GenreListArgs): Promise<JFGenreList> => {