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:
@@ -8,7 +8,7 @@
|
||||
import { useCallback } from "react";
|
||||
import { useNavigate } from "react-router";
|
||||
import { Trans } from "@lingui/react/macro";
|
||||
import { API_URL } from "../../config/api.ts";
|
||||
import { userApiUrl } from "../../utils/shared/urls.ts";
|
||||
import type { Wire } from "../../../shared/api.ts";
|
||||
import type { Playlist } from "../../../shared/playlist.ts";
|
||||
import type { PublicUser } from "../../../shared/user.ts";
|
||||
@@ -45,7 +45,7 @@ function useFollowList<T>(
|
||||
view: FollowView,
|
||||
deserialize: (wire: Wire<T>) => T,
|
||||
) {
|
||||
const url = `${API_URL}/api/users/${userId}/follow/${view}`;
|
||||
const url = userApiUrl({ id: userId }, "follow", view);
|
||||
const paged = usePagedList<T>(
|
||||
url,
|
||||
useCallback(
|
||||
|
||||
Reference in New Issue
Block a user