misc: Improve error handling
This commit is contained in:
1 parent
98b5e4b5c1
commit
a5460a03b4
23 files changed
+285
-202
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { ListingType } from 'lemmy-js-client'
|
||||
|
||||
export function load({ url }) {
|
||||
const type = url.searchParams.get('listingType') as ListingType
|
||||
const page = Number(url.searchParams.get('page')) || 1
|
||||
const query = url.searchParams.get('q')
|
||||
|
||||
if (query) {
|
||||
return getClient().search({
|
||||
limit: 40,
|
||||
page: page,
|
||||
sort: 'Active',
|
||||
type_: 'Communities',
|
||||
listing_type: type,
|
||||
q: query,
|
||||
})
|
||||
} else {
|
||||
return getClient().listCommunities({
|
||||
limit: 40,
|
||||
page: page,
|
||||
sort: 'Active',
|
||||
type_: type,
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user