feat: switch fetch function
This commit is contained in:
1 parent
bf63026108
commit
2035ee052a
10 files changed
+38
-29
No files matched your search
@@ -3,13 +3,13 @@ import { getClient } from '$lib/lemmy.js'
|
||||
import type { ListingType } from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export async function load({ url }) {
|
||||
export async function load({ url, fetch }) {
|
||||
const type = url.searchParams.get('type') as ListingType
|
||||
const page = Number(url.searchParams.get('page')) || 1
|
||||
const query = url.searchParams.get('q')
|
||||
|
||||
if (query) {
|
||||
return await getClient().search({
|
||||
return await getClient(undefined, fetch).search({
|
||||
limit: 40,
|
||||
page: page,
|
||||
sort: 'TopAll',
|
||||
@@ -19,7 +19,7 @@ export async function load({ url }) {
|
||||
auth: get(profile)?.jwt,
|
||||
})
|
||||
} else {
|
||||
return await getClient().listCommunities({
|
||||
return await getClient(undefined, fetch).listCommunities({
|
||||
limit: 40,
|
||||
page: page,
|
||||
sort: 'TopAll',
|
||||
|
||||
Reference in new issue
Block a user