feat: wire public posts api
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { getJSON } from "../../../api";
|
||||
import { langQuery, type Lang } from "../../../i18n";
|
||||
import { sourceLanguageQuery } from "../../../i18nLanguages";
|
||||
import { MOCK_POSTS } from "../../../mocks/mockPosts";
|
||||
import type { Post, PostListResponse, PostScope } from "../../../types/post";
|
||||
|
||||
@@ -70,7 +71,7 @@ function buildRealUrl(params: PostStreamParams, cursor?: string): string {
|
||||
sp.set("limit", String(PAGE_SIZE));
|
||||
if (params.scope.kind === "category") sp.set("category", params.scope.slug);
|
||||
if (params.type && params.type !== "all") sp.set("type", params.type);
|
||||
if (params.language) sp.set("language", params.language);
|
||||
if (params.language) sp.set("language", sourceLanguageQuery(params.language));
|
||||
if (cursor) sp.set("cursor", cursor);
|
||||
return `/api/posts?${sp.toString()}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user