fix: map chinese language requests to zh-CN
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { getJSON } from "../../../api";
|
||||
import { langQuery, type Lang } from "../../../i18n";
|
||||
import { MOCK_POSTS } from "../../../mocks/mockPosts";
|
||||
import type { Post, PostListResponse, PostScope } from "../../../types/post";
|
||||
|
||||
@@ -12,7 +13,7 @@ export type PostStreamParams = {
|
||||
scope: PostScope;
|
||||
type?: string;
|
||||
language?: string;
|
||||
lang: string;
|
||||
lang: Lang;
|
||||
};
|
||||
|
||||
export type PostStreamResult = {
|
||||
@@ -65,7 +66,7 @@ function filterMock(params: PostStreamParams): Post[] {
|
||||
|
||||
function buildRealUrl(params: PostStreamParams, cursor?: string): string {
|
||||
const sp = new URLSearchParams();
|
||||
sp.set("lang", params.lang);
|
||||
sp.set("lang", langQuery(params.lang));
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user