feat(mobile): use feedIdList
This commit is contained in:
@@ -9,10 +9,10 @@ import { entrySyncServices, useEntryStore } from "./store"
|
||||
import type { EntryModel, FetchEntriesProps } from "./types"
|
||||
|
||||
export const usePrefetchEntries = (props: Omit<FetchEntriesProps, "pageParam" | "read"> | null) => {
|
||||
const { feedId, inboxId, listId, view, limit } = props || {}
|
||||
const { feedId, inboxId, listId, view, limit, feedIdList } = props || {}
|
||||
const unreadOnly = useGeneralSettingKey("unreadOnly")
|
||||
return useInfiniteQuery({
|
||||
queryKey: ["entries", feedId, inboxId, listId, view, unreadOnly, limit],
|
||||
queryKey: ["entries", feedId, inboxId, listId, view, unreadOnly, limit, feedIdList],
|
||||
queryFn: ({ pageParam }) =>
|
||||
entrySyncServices.fetchEntries({ ...props, pageParam, read: unreadOnly ? false : undefined }),
|
||||
getNextPageParam: (lastPage) => lastPage.data?.at(-1)?.entries.publishedAt,
|
||||
|
||||
@@ -342,12 +342,14 @@ class EntryActions {
|
||||
|
||||
class EntrySyncServices {
|
||||
async fetchEntries(props: FetchEntriesProps) {
|
||||
const { feedId, inboxId, listId, view, read, limit, pageParam, isCollection } = props
|
||||
const { feedId, inboxId, listId, view, read, limit, pageParam, isCollection, feedIdList } =
|
||||
props
|
||||
const params = getEntriesParams({
|
||||
feedId,
|
||||
inboxId,
|
||||
listId,
|
||||
view,
|
||||
feedIdList,
|
||||
})
|
||||
const res = params.inboxId
|
||||
? await apiClient.entries.inbox.$post({
|
||||
|
||||
@@ -19,11 +19,13 @@ export function getEntriesParams({
|
||||
inboxId,
|
||||
listId,
|
||||
view,
|
||||
feedIdList,
|
||||
}: {
|
||||
feedId?: number | string
|
||||
inboxId?: number | string
|
||||
listId?: number | string
|
||||
view?: number
|
||||
feedIdList?: string[]
|
||||
}) {
|
||||
const params: {
|
||||
feedId?: string
|
||||
@@ -37,6 +39,8 @@ export function getEntriesParams({
|
||||
params.inboxId = `${inboxId}`
|
||||
} else if (listId) {
|
||||
params.listId = `${listId}`
|
||||
} else if (feedIdList) {
|
||||
params.feedIdList = feedIdList
|
||||
} else if (feedId) {
|
||||
if (feedId === FEED_COLLECTION_LIST) {
|
||||
params.isCollection = true
|
||||
|
||||
Reference in New Issue
Block a user