misc: allow listing type parameters in search
This commit is contained in:
1 parent
8c5478076e
commit
64a2610fa5
1 file changed
+5
-3
@@ -1,9 +1,10 @@
|
|||||||
import { profile } from '$lib/auth.js'
|
import { profile } from '$lib/auth.js'
|
||||||
import { getClient } from '$lib/lemmy.js'
|
import { client, getClient } from '$lib/lemmy.js'
|
||||||
import { getItemPublished } from '$lib/lemmy/item.js'
|
import { getItemPublished } from '$lib/lemmy/item.js'
|
||||||
import type {
|
import type {
|
||||||
CommentView,
|
CommentView,
|
||||||
CommunityView,
|
CommunityView,
|
||||||
|
ListingType,
|
||||||
PersonView,
|
PersonView,
|
||||||
PostView,
|
PostView,
|
||||||
SearchResponse,
|
SearchResponse,
|
||||||
@@ -18,15 +19,16 @@ export async function load({ url, fetch }) {
|
|||||||
const community = Number(url.searchParams.get('community')) || undefined
|
const community = Number(url.searchParams.get('community')) || undefined
|
||||||
const sort = url.searchParams.get('sort') || 'New'
|
const sort = url.searchParams.get('sort') || 'New'
|
||||||
const type = url.searchParams.get('type') || 'All'
|
const type = url.searchParams.get('type') || 'All'
|
||||||
|
const listing_type = url.searchParams.get('listing_type') as ListingType || 'All'
|
||||||
|
|
||||||
if (query) {
|
if (query) {
|
||||||
const results = await getClient(undefined, fetch).search({
|
const results = await client({ func: fetch }).search({
|
||||||
q: query,
|
q: query,
|
||||||
community_id: community ?? undefined,
|
community_id: community ?? undefined,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
page: page,
|
page: page,
|
||||||
sort: (sort as SortType) || 'TopAll',
|
sort: (sort as SortType) || 'TopAll',
|
||||||
listing_type: 'All',
|
listing_type: listing_type,
|
||||||
type_: (type as SearchType) ?? 'All',
|
type_: (type as SearchType) ?? 'All',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user