feat(desktop): trending api types

This commit is contained in:
DIYgod 2025-05-15 15:57:03 +08:00
parent a9172317b7
commit 75102f4e12
No known key found for this signature in database
3 changed files with 6 additions and 31 deletions

View File

@ -1,17 +0,0 @@
import type { Models } from "@follow/models"
import camelcaseKeys from "camelcase-keys"
import { apiFetch } from "~/lib/api-fetch"
const v1ApiPrefix = "/v1"
export const getTrendingAggregates = async (params: { language: string }) => {
const data = await apiFetch<Models.TrendingAggregates>(
`${v1ApiPrefix}/trendings?language=${params.language}`,
{
params: {
language: params.language,
},
},
)
return camelcaseKeys(data as any, { deep: true }) as Models.TrendingAggregates
}

View File

@ -1,14 +1,13 @@
import { ResponsiveSelect } from "@follow/components/ui/select/responsive.js"
import { Skeleton } from "@follow/components/ui/skeleton/index.jsx"
import { views } from "@follow/constants"
import type { FeedModel } from "@follow/models"
import { cn } from "@follow/utils/utils"
import { useQuery } from "@tanstack/react-query"
import { useState } from "react"
import { useTranslation } from "react-i18next"
import { useGeneralSettingKey } from "~/atoms/settings/general"
import { apiFetch } from "~/lib/api-fetch"
import { apiClient } from "~/lib/api-fetch"
import { TrendingFeedCard } from "../discover/TrendingFeedCard"
@ -27,7 +26,7 @@ const LanguageOptions = [
},
]
type Language = (typeof LanguageOptions)[number]["value"]
type Language = "all" | "eng" | "cmn"
const viewOptions = [
{
@ -61,15 +60,8 @@ export function Trending({
const { data, isLoading } = useQuery({
queryKey: ["trending", selectedLang, selectedView],
queryFn: async () => {
return await apiFetch<{
data: {
feed: FeedModel
view: number
subscriptionCount: number
}[]
}>("/trending/feeds", {
method: "GET",
params: {
return await apiClient.trending.feeds.$get({
query: {
language: selectedLang === "all" ? undefined : selectedLang,
view: selectedView === "all" ? undefined : Number(selectedView),
limit,

View File

@ -17243,14 +17243,14 @@ declare const _routes: hono_hono_base.HonoBase<Env, ({
updatedAt: string;
suspended: boolean | null;
}[] | null | undefined;
} | null;
};
analytics: {
view: number | null;
feedId: string;
updatesPerWeek: number | null;
subscriptionCount: number | null;
latestEntryPublishedAt: string | null;
} | null;
};
}[];
};
outputFormat: "json";