feat: add community cards with a hacky slot parameter
This commit is contained in:
1 parent
b65d78b973
commit
d2b27803b4
9 files changed
+78
-39
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import { client } from '$lib/lemmy.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import type { SortType } from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export async function load({ params, fetch, url }) {
|
||||
const cursor: string | undefined = url.searchParams.get('cursor') as
|
||||
| string
|
||||
| undefined
|
||||
const page = Number(url.searchParams.get('page')) || undefined
|
||||
|
||||
const sort: SortType =
|
||||
(url.searchParams.get('sort') as SortType) ||
|
||||
get(userSettings).defaultSort.sort
|
||||
|
||||
return {
|
||||
sort: sort,
|
||||
page: page || 1,
|
||||
posts: client({ func: fetch }).getPosts({
|
||||
limit: 40,
|
||||
community_name: params.name,
|
||||
page: page,
|
||||
sort: sort,
|
||||
page_cursor: cursor,
|
||||
}),
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user