fix: Creators page 422 — limit=200 exceeded API max of 100, also fix error display for Pydantic validation arrays
This commit is contained in:
parent
ac45ce7313
commit
e08e8d021f
2 changed files with 3 additions and 2 deletions
|
|
@ -176,7 +176,8 @@ async function request<T>(url: string, init?: RequestInit): Promise<T> {
|
||||||
try {
|
try {
|
||||||
const body: unknown = await res.json();
|
const body: unknown = await res.json();
|
||||||
if (typeof body === "object" && body !== null && "detail" in body) {
|
if (typeof body === "object" && body !== null && "detail" in body) {
|
||||||
detail = String((body as { detail: unknown }).detail);
|
const d = (body as { detail: unknown }).detail;
|
||||||
|
detail = typeof d === "string" ? d : Array.isArray(d) ? d.map((e: any) => e.msg || JSON.stringify(e)).join("; ") : JSON.stringify(d);
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// body not JSON — keep statusText
|
// body not JSON — keep statusText
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ export default function CreatorsBrowse() {
|
||||||
const res = await fetchCreators({
|
const res = await fetchCreators({
|
||||||
sort,
|
sort,
|
||||||
genre: genreFilter ?? undefined,
|
genre: genreFilter ?? undefined,
|
||||||
limit: 200,
|
limit: 100,
|
||||||
});
|
});
|
||||||
if (!cancelled) setCreators(res.items);
|
if (!cancelled) setCreators(res.items);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue