feat: separate popular browse navigation
This commit is contained in:
@@ -15,6 +15,7 @@ export type PostStreamParams = {
|
||||
type?: string;
|
||||
language?: string;
|
||||
q?: string;
|
||||
sort?: string;
|
||||
lang: Lang;
|
||||
};
|
||||
|
||||
@@ -87,6 +88,7 @@ function buildRealUrl(params: PostStreamParams, cursor?: string): string {
|
||||
if (q) sp.set("q", q);
|
||||
if (params.scope.kind === "category") sp.set("category", params.scope.slug);
|
||||
if (params.type && params.type !== "all") sp.set("type", params.type);
|
||||
if (params.sort) sp.set("sort", params.sort);
|
||||
if (params.language) sp.set("language", sourceLanguageQuery(params.language));
|
||||
if (cursor) sp.set("cursor", cursor);
|
||||
return `${q ? "/api/posts/search" : "/api/posts"}?${sp.toString()}`;
|
||||
@@ -163,6 +165,7 @@ export function usePostStream(params: PostStreamParams): PostStreamResult {
|
||||
params.type,
|
||||
params.language,
|
||||
params.q,
|
||||
params.sort,
|
||||
params.lang,
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user