feat: pages pagination loading
This commit is contained in:
parent
0a8a2c3248
commit
a79b6a7034
|
|
@ -79,6 +79,7 @@ export type Note = UniNote & {
|
|||
export type Notes = {
|
||||
total: number
|
||||
list: Note[]
|
||||
cursor?: string
|
||||
}
|
||||
|
||||
export type Profile = UniProfile & {
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ export async function getPagesBySite(input: {
|
|||
|
||||
const visibility = input.visibility || PageVisibilityEnum.All
|
||||
|
||||
let pages: Notes = (await unidata.notes.get({
|
||||
const options = {
|
||||
source: "Crossbell Note",
|
||||
identity: input.site,
|
||||
platform: "Crossbell",
|
||||
|
|
@ -208,11 +208,26 @@ export async function getPagesBySite(input: {
|
|||
tags: [...(input.tags || []), input.type],
|
||||
applications: ["xlog"],
|
||||
},
|
||||
})) || {
|
||||
cursor: "",
|
||||
}
|
||||
|
||||
let pages: Notes = {
|
||||
total: 0,
|
||||
list: [],
|
||||
}
|
||||
|
||||
let cursor = ""
|
||||
do {
|
||||
options.cursor = cursor
|
||||
const res = (await unidata.notes.get(options)) || {
|
||||
total: 0,
|
||||
list: [],
|
||||
}
|
||||
pages.total = res.total
|
||||
pages.list = pages.list.concat(res.list)
|
||||
cursor = res.cursor
|
||||
} while (cursor)
|
||||
|
||||
const local = getLocalPages({
|
||||
site: input.site,
|
||||
isPost: input.type === "post",
|
||||
|
|
|
|||
Loading…
Reference in New Issue