Lets the user add a dump to their playlists or take it out, in
AddToPlaylistModal and the dump form's last step. It loads which of their
playlists hold the dump.
f
usePlaylistMemberships(dumpId: string | null): UsePlaylistMembershipsResult
Returns the user's playlists with whether each holds dumpId, from
GET /api/me/playlists?contains=:dumpId. A null dumpId, as before
DumpCreateModal has posted its dump, loads nothing.
I
UsePlaylistMembershipsResult
Returned by usePlaylistMemberships to AddToPlaylistModal and
DumpCreateModal, for their PlaylistMembershipPanel.
-
add: (membership: PlaylistMembership) => void
Puts first a playlist the panel just created with the dump in it.
- loading: boolean
-
memberships: PlaylistMembership[]
Empty while loading, and when the load failed.
-
toggle: (membership: PlaylistMembership) => Promise<void>
Adds the dump to the playlist or takes it out on the server, and shows it only once the server agrees. A refusal or a dropped connection changes nothing.
Usage
import * as mod from "src/hooks/playlist/usePlaylistMemberships.ts";