feat: rewrite post feed fetching

This commit is contained in:
Xylight committed 2024-07-18 18:33:23 -07:00
1 parent 1a30bcee1d
commit 4e0d79ddef
8 files changed
+312 -241

No files matched your search

+11 -7
View File
@@ -1,4 +1,5 @@
import { client } from '$lib/lemmy.js'
import { postFeed } from '$lib/lemmy/postfeed.js'
import { userSettings } from '$lib/settings.js'
import type { SortType } from 'lemmy-js-client'
import { get } from 'svelte/store'
@@ -16,13 +17,16 @@ export async function load({ params, fetch, url }) {
return {
sort: sort,
page: page || 1,
posts: await client({ func: fetch }).getPosts({
limit: 40,
community_name: params.name,
page: page,
sort: sort,
page_cursor: cursor,
show_hidden: get(userSettings).posts.showHidden,
posts: await postFeed({
id: 'community',
url: url,
request: {
page: page,
page_cursor: cursor,
sort: sort,
limit: 20,
community_name: params.name,
}
}),
}
}