v4: every request about a user, and the dump editor's path, come from one builder each — fourteen places wrote /api/users/<key>/… by hand, some encoding a handle (@alice%40music.example) and some not, a slug never; userApiUrl (src/utils/shared/urls.ts) now writes them all, by the user's id or by @ and the handle a page's path gives, each segment encoded. The editor's path was the dump's page's with /edit added in two places; dumpPath takes the view, as userPath and feedPath do.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -28,7 +28,7 @@ import {
|
||||
deserializePlaylistWithDumps,
|
||||
} from "../../utils/shared/deserialize.ts";
|
||||
import { expectOk, friendlyFetchError } from "../../utils/shared/api.ts";
|
||||
import { isAt, playlistUrl } from "../../utils/shared/urls.ts";
|
||||
import { isAt, playlistUrl, userApiUrl } from "../../utils/shared/urls.ts";
|
||||
import { useCanonicalPath } from "../shared/useCanonicalPath.ts";
|
||||
import { useAuth } from "../auth/useAuth.ts";
|
||||
import { useWS } from "../ws/useWS.ts";
|
||||
@@ -124,7 +124,8 @@ export function usePlaylist(
|
||||
`${target.username}/${target.slug}:${user?.id ?? "guest"}`,
|
||||
(signal) =>
|
||||
authFetch(
|
||||
`${API_URL}/api/users/@${target.username}/playlists/${target.slug}`,
|
||||
// The key above is falsy, and nothing fetched, without both.
|
||||
userApiUrl({ username: target.username! }, "playlists", target.slug!),
|
||||
{ signal },
|
||||
)
|
||||
.then(expectOk<Wire<PlaylistWithDumps>>)
|
||||
|
||||
Reference in New Issue
Block a user