feat: add community search to search page

This commit is contained in:
Xyphyn committed 2023-09-04 10:49:31 -07:00
1 parent 819fde66ab
commit e946d0de48
44 files changed
+79 -218

No files matched your search

+6 -2
View File
@@ -15,7 +15,7 @@ import { get } from 'svelte/store'
export async function load({ url, fetch }) {
const query = url.searchParams.get('q')
const page = Number(url.searchParams.get('page')) || 1
const community = url.searchParams.get('community_name')
const community = Number(url.searchParams.get('community')) || undefined
const sort = url.searchParams.get('sort') || 'New'
const type = url.searchParams.get('type') || 'All'
@@ -23,7 +23,7 @@ export async function load({ url, fetch }) {
const results = await getClient(undefined, fetch).search({
q: query,
auth: get(profile)?.jwt,
community_name: community ?? undefined,
community_id: community ?? undefined,
limit: 40,
page: page,
sort: (sort as SortType) || 'New',
@@ -47,6 +47,7 @@ export async function load({ url, fetch }) {
type: type,
sort: sort,
page: page,
query: query,
results: everything,
streamed: {
object: get(profile)?.jwt
@@ -61,5 +62,8 @@ export async function load({ url, fetch }) {
return {
page: 1,
sort: sort,
type: type,
query: query,
}
}