misc: add settings pages

This commit is contained in:
Xyphyn committed 2023-08-13 13:00:00 -07:00
1 parent 7e76b1684c
commit f493f19c60
12 files changed
+270 -148

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
import { profile } from '$lib/auth.js'
import { getClient } from '$lib/lemmy.js'
import { userSettings } from '$lib/settings.js'
import type { ListingType, SortType } from 'lemmy-js-client'
import { get } from 'svelte/store'
export async function load(req: any) {
const page = Number(req.url.searchParams.get('page') || 1) || 1
const sort: SortType =
(req.url.searchParams.get('sort') as SortType) ||
get(userSettings).defaultSort.sort
return {
sort: sort,
page: page,
posts: await getClient(undefined, req.fetch).getPosts({
limit: 40,
community_name: req.params.name,
page: page,
sort: sort,
auth: get(profile)?.jwt,
}),
community: await getClient(undefined, req.fetch).getCommunity({
name: req.params.name,
auth: get(profile)?.jwt,
}),
}
}