misc: fix saved posts not showing all posts
This commit is contained in:
1 parent
990e4d8c7b
commit
f3fc1adf90
4 files changed
+17
-19
No files matched your search
@@ -8,6 +8,7 @@
|
||||
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { uploadImage } from '$lib/lemmy.js'
|
||||
import type { Community, Person } from 'lemmy-js-client'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import {
|
||||
CodeBracket,
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Saved posts</title>
|
||||
<title>Saved</title>
|
||||
</svelte:head>
|
||||
|
||||
<h1 class="text-xl font-bold">Saved Posts</h1>
|
||||
<h1 class="text-2xl font-bold">Saved</h1>
|
||||
<div class="flex flex-col gap-4 list-none my-4">
|
||||
{#if !data.data || (data.data?.length ?? 0) == 0}
|
||||
<p class="text-center opacity-60 text-lg mx-4">
|
||||
|
||||
+13
-16
@@ -1,6 +1,6 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { CommentView, PostView } from 'lemmy-js-client'
|
||||
import type { CommentSortType, CommentView, ListingType, PostView, SortType } from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
function getSavedItemPublished(item: PostView | CommentView) {
|
||||
@@ -17,22 +17,19 @@ export async function load({ url, fetch }) {
|
||||
|
||||
const client = getClient(undefined, fetch)
|
||||
|
||||
const [posts, comments] = await Promise.all([
|
||||
client.getPosts({
|
||||
saved_only: true,
|
||||
auth: get(profile)!.jwt,
|
||||
limit: 20,
|
||||
page: page,
|
||||
sort: 'New',
|
||||
}),
|
||||
const params = {
|
||||
auth: get(profile)!.jwt!,
|
||||
saved_only: true,
|
||||
limit: 20,
|
||||
page: page,
|
||||
sort: 'New' as SortType & CommentSortType,
|
||||
type_: 'All' as ListingType
|
||||
}
|
||||
|
||||
client.getComments({
|
||||
saved_only: true,
|
||||
auth: get(profile)!.jwt,
|
||||
limit: 20,
|
||||
page: page,
|
||||
sort: 'New',
|
||||
}),
|
||||
const [posts, comments] = await Promise.all([
|
||||
client.getPosts(params),
|
||||
|
||||
client.getComments(params),
|
||||
])
|
||||
|
||||
const everything = [...posts.posts, ...comments.comments].sort(
|
||||
|
||||
Reference in new issue
Block a user