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
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "photon-lemmy",
|
"name": "photon-lemmy",
|
||||||
"version": "0.9.3",
|
"version": "0.9.4",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
||||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||||
import { uploadImage } from '$lib/lemmy.js'
|
import { uploadImage } from '$lib/lemmy.js'
|
||||||
|
import type { Community, Person } from 'lemmy-js-client'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
import {
|
import {
|
||||||
CodeBracket,
|
CodeBracket,
|
||||||
|
|||||||
@@ -16,10 +16,10 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>Saved posts</title>
|
<title>Saved</title>
|
||||||
</svelte:head>
|
</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">
|
<div class="flex flex-col gap-4 list-none my-4">
|
||||||
{#if !data.data || (data.data?.length ?? 0) == 0}
|
{#if !data.data || (data.data?.length ?? 0) == 0}
|
||||||
<p class="text-center opacity-60 text-lg mx-4">
|
<p class="text-center opacity-60 text-lg mx-4">
|
||||||
|
|||||||
+13
-16
@@ -1,6 +1,6 @@
|
|||||||
import { profile } from '$lib/auth.js'
|
import { profile } from '$lib/auth.js'
|
||||||
import { getClient } from '$lib/lemmy.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'
|
import { get } from 'svelte/store'
|
||||||
|
|
||||||
function getSavedItemPublished(item: PostView | CommentView) {
|
function getSavedItemPublished(item: PostView | CommentView) {
|
||||||
@@ -17,22 +17,19 @@ export async function load({ url, fetch }) {
|
|||||||
|
|
||||||
const client = getClient(undefined, fetch)
|
const client = getClient(undefined, fetch)
|
||||||
|
|
||||||
const [posts, comments] = await Promise.all([
|
const params = {
|
||||||
client.getPosts({
|
auth: get(profile)!.jwt!,
|
||||||
saved_only: true,
|
saved_only: true,
|
||||||
auth: get(profile)!.jwt,
|
limit: 20,
|
||||||
limit: 20,
|
page: page,
|
||||||
page: page,
|
sort: 'New' as SortType & CommentSortType,
|
||||||
sort: 'New',
|
type_: 'All' as ListingType
|
||||||
}),
|
}
|
||||||
|
|
||||||
client.getComments({
|
const [posts, comments] = await Promise.all([
|
||||||
saved_only: true,
|
client.getPosts(params),
|
||||||
auth: get(profile)!.jwt,
|
|
||||||
limit: 20,
|
client.getComments(params),
|
||||||
page: page,
|
|
||||||
sort: 'New',
|
|
||||||
}),
|
|
||||||
])
|
])
|
||||||
|
|
||||||
const everything = [...posts.posts, ...comments.comments].sort(
|
const everything = [...posts.posts, ...comments.comments].sort(
|
||||||
|
|||||||
Reference in new issue
Block a user