feat: Add default sorts

This commit is contained in:
Xyphyn committed 2023-07-22 16:27:22 -07:00
1 parent 75a7e87110
commit 123336871d
6 files changed
+49 -8

No files matched your search

+4 -2
View File
@@ -1,4 +1,5 @@
import { authData, getClient } from '$lib/lemmy.js'
import { userSettings } from '$lib/settings.js'
import type { ListingType, SortType } from 'lemmy-js-client'
import { get } from 'svelte/store'
@@ -6,7 +7,8 @@ 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) || 'Active'
(req.url.searchParams.get('sort') as SortType) ||
get(userSettings).defaultSort.sort
return {
posts: getClient().getPosts({
@@ -18,7 +20,7 @@ export async function load(req: any) {
}),
community: getClient().getCommunity({
name: req.params.name,
auth: get(authData)?.token
auth: get(authData)?.token,
}),
}
}