Subsonic 2, general rework (#758)

This commit is contained in:
Kendall Garner 2024-09-26 04:23:08 +00:00 committed by GitHub
parent 31492fa9ef
commit 8cddbef701
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
69 changed files with 4625 additions and 3566 deletions

View file

@ -494,17 +494,24 @@ export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
const removeFromPlaylistMutation = useRemoveFromPlaylist();
const handleRemoveFromPlaylist = useCallback(() => {
const songId =
(serverType === ServerType.NAVIDROME || ServerType.JELLYFIN
? ctx.dataNodes?.map((node) => node.data.playlistItemId)
: ctx.dataNodes?.map((node) => node.data.id)) || [];
let songId: string[] | undefined;
switch (serverType) {
case ServerType.NAVIDROME:
case ServerType.JELLYFIN:
songId = ctx.dataNodes?.map((node) => node.data.playlistItemId);
break;
case ServerType.SUBSONIC:
songId = ctx.dataNodes?.map((node) => node.rowIndex!.toString());
break;
}
const confirm = () => {
removeFromPlaylistMutation.mutate(
{
query: {
id: ctx.context.playlistId,
songId,
songId: songId || [],
},
serverId: ctx.data?.[0]?.serverId,
},