mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2026-03-02 02:41:34 +00:00
Infinite scroll
This commit is contained in:
parent
a3b4e2e64e
commit
b5f163891c
7 changed files with 93 additions and 11 deletions
|
|
@ -10,5 +10,20 @@ module.exports = [
|
|||
await user.timeline.fetchUpToPage(page - 1)
|
||||
}
|
||||
return render(200, "pug/user.pug", {url, user})
|
||||
}},
|
||||
{route: "/fragment/user/([\\w.]+)/(\\d+)", methods: ["GET"], code: async ({url, fill}) => {
|
||||
const user = await fetchUser(fill[0])
|
||||
const pageNumber = +fill[1]
|
||||
const pageIndex = pageNumber - 1
|
||||
await user.timeline.fetchUpToPage(pageIndex)
|
||||
if (user.timeline.pages[pageIndex]) {
|
||||
return render(200, "pug/fragments/timeline_page.pug", {page: user.timeline.pages[pageIndex], pageIndex, user, url})
|
||||
} else {
|
||||
return {
|
||||
statusCode: 400,
|
||||
contentType: "text/html",
|
||||
content: "That page does not exist"
|
||||
}
|
||||
}
|
||||
}}
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue