function usePlaylist
usePlaylist(
username: string | undefined,
slug: string | undefined,
view?: "edit"
): UsePlaylistResult

Returns the playlist at /@username/playlists/slug from GET /api/users/@:username/playlists/:slug, with the dumps the viewer may see in it. The socket's events keep its details and dumps live: a dump another client removes, or that turns private, fades out, one it adds, or that turns public, is fetched, a new order is applied, and a playlist deleted, or turned private by someone else, sends the page home. A reconnection loads it again. A new slug replaces the URL, keeping the page's view, and a path that names the playlist on screen, as that one does, fetches nothing.

Parameters

username: string | undefined
slug: string | undefined
optional
view: "edit"

Return Type

Usage

import { usePlaylist } from "src/hooks/playlist/usePlaylist.ts";