feat: Add default sorts
This commit is contained in:
1 parent
75a7e87110
commit
123336871d
6 files changed
+49
-8
No files matched your search
+6
-2
@@ -1,13 +1,17 @@
|
||||
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'
|
||||
|
||||
export async function load({ url }) {
|
||||
const page = Number(url.searchParams.get('page') || 1) || 1
|
||||
|
||||
const sort: SortType = (url.searchParams.get('sort') as SortType) || 'Active'
|
||||
const sort: SortType =
|
||||
(url.searchParams.get('sort') as SortType) ||
|
||||
get(userSettings).defaultSort.sort
|
||||
const listingType: ListingType =
|
||||
(url.searchParams.get('type') as ListingType) || 'Local'
|
||||
(url.searchParams.get('type') as ListingType) ||
|
||||
get(userSettings).defaultSort.feed
|
||||
|
||||
return {
|
||||
posts: getClient().getPosts({
|
||||
|
||||
Reference in new issue
Block a user