fix: piefed page cursor types won't work

This commit is contained in:
Xylight committed 2025-09-21 20:51:48 -07:00
1 parent 9a27e95a5f
commit 7f9d8c6f86
11 files changed
+504 -66

No files matched your search

BIN
View File
Binary file not shown.
+2 -2
View File
@@ -232,11 +232,11 @@ export function toFeedView(
// Query calls // Query calls
export function fromGetPosts( export function fromGetPosts(
getPosts: GetPosts, getPosts: GetPosts,
): components['schemas']['GetPosts'] { ): components['parameters']['GetPosts'] {
return { return {
...getPosts, ...getPosts,
sort: toSortType(getPosts.sort), sort: toSortType(getPosts.sort),
page_cursor: Number(getPosts.page_cursor), page: Number(getPosts.page_cursor),
} }
} }
+475 -45
View File
@@ -260,6 +260,7 @@ export interface paths {
| 'Subscribed' | 'Subscribed'
| 'Popular' | 'Popular'
| 'Moderating' | 'Moderating'
| 'ModeratorView'
page?: number page?: number
sort?: sort?:
| 'Active' | 'Active'
@@ -277,6 +278,7 @@ export interface paths {
| 'TopYear' | 'TopYear'
| 'TopAll' | 'TopAll'
| 'Scaled' | 'Scaled'
| 'Old'
community_name?: string community_name?: string
community_id?: number community_id?: number
} }
@@ -1301,6 +1303,7 @@ export interface paths {
| 'TopYear' | 'TopYear'
| 'TopAll' | 'TopAll'
| 'Scaled' | 'Scaled'
| 'Old'
page?: number page?: number
limit?: number limit?: number
/** @description Limit posts/comments to just a single community */ /** @description Limit posts/comments to just a single community */
@@ -2685,6 +2688,7 @@ export interface paths {
| 'TopSixHour' | 'TopSixHour'
| 'TopTwelveHour' | 'TopTwelveHour'
| 'TopWeek' | 'TopWeek'
| 'TopDay'
| 'TopMonth' | 'TopMonth'
| 'TopThreeMonths' | 'TopThreeMonths'
| 'TopSixMonths' | 'TopSixMonths'
@@ -2694,7 +2698,13 @@ export interface paths {
| 'New' | 'New'
| 'Scaled' | 'Scaled'
| 'Active' | 'Active'
type_?: 'All' | 'Local' | 'Subscribed' type_?:
| 'All'
| 'Local'
| 'Subscribed'
| 'Popular'
| 'Moderating'
| 'ModeratorView'
community_name?: string community_name?: string
community_id?: number community_id?: number
saved_only?: boolean saved_only?: boolean
@@ -3645,6 +3655,349 @@ export interface paths {
patch?: never patch?: never
trace?: never trace?: never
} }
'/api/alpha/private_message/list': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
/** List private messages. */
get: {
parameters: {
query?: {
page?: number
limit?: number
unread_only?: boolean
}
header?: never
path?: never
cookie?: never
}
requestBody?: never
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['ListPrivateMessagesResponse']
}
}
/** @description Bad Request */
400: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
422: components['responses']['UNPROCESSABLE_CONTENT']
}
}
put?: never
post?: never
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/api/alpha/private_message/conversation': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
/** Get conversation with a specific person. */
get: {
parameters: {
query: {
person_id: number
page?: number
limit?: number
}
header?: never
path?: never
cookie?: never
}
requestBody?: never
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['GetPrivateMessageConversationResponse']
}
}
/** @description Bad Request */
400: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
422: components['responses']['UNPROCESSABLE_CONTENT']
}
}
put?: never
post?: never
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/api/alpha/private_message': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
/** Edit a private message. */
put: {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
requestBody: {
content: {
'application/json': components['schemas']['EditPrivateMessageRequest']
}
}
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['PrivateMessageResponse']
}
}
/** @description Bad Request */
400: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
422: components['responses']['UNPROCESSABLE_CONTENT']
}
}
/** Create a new private message. */
post: {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
requestBody: {
content: {
'application/json': components['schemas']['CreatePrivateMessageRequest']
}
}
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['PrivateMessageResponse']
}
}
/** @description Bad Request */
400: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
422: components['responses']['UNPROCESSABLE_CONTENT']
/** @description Too Many Requests */
429: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
}
}
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/api/alpha/private_message/mark_as_read': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/** Mark a private message as read or unread. */
post: {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
requestBody: {
content: {
'application/json': components['schemas']['MarkPrivateMessageAsReadRequest']
}
}
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['PrivateMessageResponse']
}
}
/** @description Bad Request */
400: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
422: components['responses']['UNPROCESSABLE_CONTENT']
}
}
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/api/alpha/private_message/delete': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/** Delete or restore a private message. */
post: {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
requestBody: {
content: {
'application/json': components['schemas']['DeletePrivateMessageRequest']
}
}
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['PrivateMessageResponse']
}
}
/** @description Bad Request */
400: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
422: components['responses']['UNPROCESSABLE_CONTENT']
}
}
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/api/alpha/private_message/report': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/** Report a private message. */
post: {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
requestBody: {
content: {
'application/json': components['schemas']['ReportPrivateMessageRequest']
}
}
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['PrivateMessageResponse']
}
}
/** @description Bad Request */
400: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
422: components['responses']['UNPROCESSABLE_CONTENT']
}
}
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
} }
export type webhooks = Record<string, never> export type webhooks = Record<string, never>
export interface components { export interface components {
@@ -3696,12 +4049,16 @@ export interface components {
/** Format: html */ /** Format: html */
about_html?: string about_html?: string
/** Format: url */ /** Format: url */
avatar?: string avatar?: string | null
/** Format: url */ /** Format: url */
banner?: string banner?: string | null
flair?: string flair?: string
published: string /**
title?: string * Format: datetime
* @example 2025-06-07T02:29:07.980084Z
*/
published?: string
title?: string | null
} }
PersonView: { PersonView: {
activity_alert: boolean activity_alert: boolean
@@ -3762,12 +4119,12 @@ export interface components {
title: string title: string
banned?: boolean banned?: boolean
/** Format: url */ /** Format: url */
banner?: string banner?: string | null
/** Format: markdown */ /** Format: markdown */
description?: string description?: string
/** Format: url */ /** Format: url */
icon?: string icon?: string | null
posting_warning?: string posting_warning?: string | null
/** /**
* Format: datetime * Format: datetime
* @example 2025-06-07T02:29:07.980084Z * @example 2025-06-07T02:29:07.980084Z
@@ -3775,8 +4132,8 @@ export interface components {
updated?: string updated?: string
} }
CommunityBlockView: { CommunityBlockView: {
community: components['schemas']['Community'] community?: components['schemas']['Community']
person: components['schemas']['Person'] person?: components['schemas']['Person']
} }
CommunityFollowerView: { CommunityFollowerView: {
community: components['schemas']['Community'] community: components['schemas']['Community']
@@ -3813,8 +4170,9 @@ export interface components {
| 'Subscribed' | 'Subscribed'
| 'Popular' | 'Popular'
| 'Moderating' | 'Moderating'
| 'ModeratorView'
/** @enum {string} */ /** @enum {string} */
default_sort_type: default_sort_type?:
| 'Active' | 'Active'
| 'Hot' | 'Hot'
| 'New' | 'New'
@@ -3830,6 +4188,7 @@ export interface components {
| 'TopYear' | 'TopYear'
| 'TopAll' | 'TopAll'
| 'Scaled' | 'Scaled'
| 'Old'
show_bot_accounts: boolean show_bot_accounts: boolean
show_nsfl: boolean show_nsfl: boolean
show_nsfw: boolean show_nsfw: boolean
@@ -3948,7 +4307,7 @@ export interface components {
* Format: url * Format: url
* @description Legacy tags that existed prior to 1.2 and some tags for remote communities might not have a defined ap_id * @description Legacy tags that existed prior to 1.2 and some tags for remote communities might not have a defined ap_id
*/ */
ap_id: string ap_id: string | null
} }
CommunityView: { CommunityView: {
activity_alert: boolean activity_alert: boolean
@@ -3975,6 +4334,16 @@ export interface components {
published: string published: string
score: number score: number
upvotes: number upvotes: number
cross_posts: number
}
WidthHeight: {
width?: number
height?: number
}
MiniCrossPosts: {
post_id?: number
reply_count?: number
community_name?: string
} }
Post: { Post: {
/** Format: url */ /** Format: url */
@@ -4009,6 +4378,8 @@ export interface components {
updated?: string updated?: string
/** Format: url */ /** Format: url */
url?: string url?: string
image_details?: components['schemas']['WidthHeight']
cross_posts?: components['schemas']['MiniCrossPosts'][]
} }
PostView: { PostView: {
banned_from_community: boolean banned_from_community: boolean
@@ -4130,7 +4501,7 @@ export interface components {
} }
ListCommunitiesResponse: { ListCommunitiesResponse: {
communities: components['schemas']['CommunityView'][] communities: components['schemas']['CommunityView'][]
next_page?: string next_page?: string | null
} }
FollowCommunityRequest: { FollowCommunityRequest: {
community_id: number community_id: number
@@ -4152,12 +4523,12 @@ export interface components {
name: string name: string
title: string title: string
/** Format: url */ /** Format: url */
banner_url?: string banner_url?: string | null
/** Format: markdown */ /** Format: markdown */
description?: string description?: string
discussion_languages?: number[] discussion_languages?: number[]
/** Format: url */ /** Format: url */
icon_url?: string icon_url?: string | null
local_only?: boolean local_only?: boolean
nsfw?: boolean nsfw?: boolean
restricted_to_mods?: boolean restricted_to_mods?: boolean
@@ -4167,12 +4538,12 @@ export interface components {
community_id: number community_id: number
title?: string title?: string
/** Format: url */ /** Format: url */
banner_url?: string banner_url?: string | null
/** Format: markdown */ /** Format: markdown */
description?: string description?: string
discussion_languages?: number[] discussion_languages?: number[]
/** Format: url */ /** Format: url */
icon_url?: string icon_url?: string | null
local_only?: boolean local_only?: boolean
nsfw?: boolean nsfw?: boolean
restricted_to_mods?: boolean restricted_to_mods?: boolean
@@ -4203,17 +4574,17 @@ export interface components {
* Format: datetime * Format: datetime
* @example 2025-06-07T02:29:07.980084Z, null=permanent ban * @example 2025-06-07T02:29:07.980084Z, null=permanent ban
*/ */
expired_at?: string expired_at?: string | null
/** /**
* Format: datetime * Format: datetime
* @example 2025-06-07T02:29:07.980084Z, null=permanent ban * @example 2025-06-07T02:29:07.980084Z, null=permanent ban
*/ */
expires_at?: string expires_at?: string | null
reason?: string reason?: string
} }
CommunityModerationBansListResponse: { CommunityModerationBansListResponse: {
items?: components['schemas']['CommunityModerationBanItem'][] items?: components['schemas']['CommunityModerationBanItem'][]
next_page?: string next_page?: string | null
} }
CommunityModerationUnbanRequest: { CommunityModerationUnbanRequest: {
community_id: number community_id: number
@@ -4271,7 +4642,7 @@ export interface components {
* Format: url * Format: url
* @description Legacy tags that existed prior to 1.2 and some tags for remote communities might not have a defined ap_id * @description Legacy tags that existed prior to 1.2 and some tags for remote communities might not have a defined ap_id
*/ */
ap_id: string ap_id: string | null
} }
CommunityFlairEditRequest: { CommunityFlairEditRequest: {
flair_id: number flair_id: number
@@ -4307,7 +4678,7 @@ export interface components {
* Format: url * Format: url
* @description Legacy tags that existed prior to 1.2 and some tags for remote communities might not have a defined ap_id * @description Legacy tags that existed prior to 1.2 and some tags for remote communities might not have a defined ap_id
*/ */
ap_id: string ap_id: string | null
} }
CommunityFlairDeleteRequest: { CommunityFlairDeleteRequest: {
flair_id: number flair_id: number
@@ -4351,14 +4722,14 @@ export interface components {
/** @description user_id of the feed creator/owner */ /** @description user_id of the feed creator/owner */
user_id: number user_id: number
/** Format: url */ /** Format: url */
banner?: string banner?: string | null
/** Format: markdown */ /** Format: markdown */
description?: string description?: string | null
/** Format: html */ /** Format: html */
description_html?: string description_html?: string | null
/** Format: url */ /** Format: url */
icon?: string icon?: string | null
parent_feed_id?: number parent_feed_id?: number | null
} }
FeedListResponse: { FeedListResponse: {
feeds: components['schemas']['FeedView'][] feeds: components['schemas']['FeedView'][]
@@ -4371,7 +4742,7 @@ export interface components {
name: string name: string
show_posts_from_children: boolean show_posts_from_children: boolean
title: string title: string
parent_topic_id?: number parent_topic_id?: number | null
} }
TopicListResponse: { TopicListResponse: {
topics: components['schemas']['TopicView'][] topics: components['schemas']['TopicView'][]
@@ -4429,11 +4800,11 @@ export interface components {
subscribed: 'Subscribed' | 'NotSubscribed' | 'Pending' subscribed: 'Subscribed' | 'NotSubscribed' | 'Pending'
} }
UserRepliesResponse: { UserRepliesResponse: {
next_page: number next_page?: string | null
replies: components['schemas']['CommentReplyView'][] replies: components['schemas']['CommentReplyView'][]
} }
UserMentionsResponse: { UserMentionsResponse: {
next_page: number next_page?: string | null
replies: components['schemas']['CommentReplyView'][] replies: components['schemas']['CommentReplyView'][]
} }
UserBlockRequest: { UserBlockRequest: {
@@ -4461,14 +4832,14 @@ export interface components {
* Format: url * Format: url
* @description Pass a null value to remove the image * @description Pass a null value to remove the image
*/ */
avatar?: string avatar?: string | null
/** Format: markdown */ /** Format: markdown */
bio?: string bio?: string
/** /**
* Format: url * Format: url
* @description Pass a null value to remove the image * @description Pass a null value to remove the image
*/ */
cover?: string cover?: string | null
/** @enum {string} */ /** @enum {string} */
default_comment_sort_type?: 'Hot' | 'Top' | 'New' | 'Old' default_comment_sort_type?: 'Hot' | 'Top' | 'New' | 'Old'
/** @enum {string} */ /** @enum {string} */
@@ -4518,7 +4889,7 @@ export interface components {
/** @enum {string} */ /** @enum {string} */
status: 'All' | 'Unread' | 'Read' status: 'All' | 'Unread' | 'Read'
username: string username: string
next_page: number next_page?: string | null
} }
UserNotificationStateRequest: { UserNotificationStateRequest: {
notif_id: number notif_id: number
@@ -4535,14 +4906,14 @@ export interface components {
UserSetFlairRequest: { UserSetFlairRequest: {
community_id: number community_id: number
/** @description Either omit or set to null to remove existing flair */ /** @description Either omit or set to null to remove existing flair */
flair_text?: string flair_text?: string | null
} }
UserSetFlairResponse: { UserSetFlairResponse: {
person_view: components['schemas']['PersonView'] person_view: components['schemas']['PersonView']
} }
ListCommentsResponse: { ListCommentsResponse: {
comments: components['schemas']['CommentView'][] comments: components['schemas']['CommentView'][]
next_page?: string next_page?: string | null
} }
LikeCommentRequest: { LikeCommentRequest: {
comment_id: number comment_id: number
@@ -4578,7 +4949,11 @@ export interface components {
body: string body: string
comment_id: number comment_id: number
language_id?: number language_id?: number
distinguished?: boolean /**
* @description Visibly mark reply as from a moderator in the web UI
* @default false
*/
distinguished: boolean
} }
DeleteCommentRequest: { DeleteCommentRequest: {
comment_id: number comment_id: number
@@ -4598,7 +4973,7 @@ export interface components {
id: number id: number
creator_id: number creator_id: number
comment_id: number comment_id: number
original_comment_text: string original_comment_text?: string
reason?: string reason?: string
resolved: boolean resolved: boolean
/** /**
@@ -4657,12 +5032,12 @@ export interface components {
creator: components['schemas']['Person'] creator: components['schemas']['Person']
} }
ListCommentLikesResponse: { ListCommentLikesResponse: {
comment_likes?: components['schemas']['CommentLikeView'][] comment_likes: components['schemas']['CommentLikeView'][]
next_page?: string next_page?: string | null
} }
ListPostsResponse: { ListPostsResponse: {
posts: components['schemas']['PostView'][] posts: components['schemas']['PostView'][]
next_page?: string next_page?: string | null
} }
GetPostResponse: { GetPostResponse: {
post_view: components['schemas']['PostView'] post_view: components['schemas']['PostView']
@@ -4690,12 +5065,13 @@ export interface components {
} }
GetPostRepliesResponse: { GetPostRepliesResponse: {
comments?: components['schemas']['PostReplyView'][] comments?: components['schemas']['PostReplyView'][]
next_page?: string next_page?: string | null
} }
LikePostRequest: { LikePostRequest: {
post_id: number post_id: number
score: number score: number
private?: boolean private?: boolean
auth?: string
} }
SavePostRequest: { SavePostRequest: {
post_id: number post_id: number
@@ -4739,7 +5115,11 @@ export interface components {
original_post_body: string original_post_body: string
reason: string reason: string
resolved: boolean resolved: boolean
published: string /**
* Format: datetime
* @example 2025-06-07T02:29:07.980084Z
*/
published?: string
} }
PostReportView: { PostReportView: {
post_report: components['schemas']['PostReport'] post_report: components['schemas']['PostReport']
@@ -4788,13 +5168,13 @@ export interface components {
creator: components['schemas']['Person'] creator: components['schemas']['Person']
} }
ListPostLikesResponse: { ListPostLikesResponse: {
post_likes?: components['schemas']['PostLikeView'][] post_likes: components['schemas']['PostLikeView'][]
next_page?: string next_page?: string | null
} }
PostSetFlairRequest: { PostSetFlairRequest: {
post_id: number post_id: number
/** @description A list of all the flair id to assign to the post. Either pass an empty list or null to remove flair */ /** @description A list of all the flair id to assign to the post. Either pass an empty list or null to remove flair */
flair_id_list?: number[] flair_id_list?: number[] | null
} }
PostSetFlairResponse: { PostSetFlairResponse: {
banned_from_community: boolean banned_from_community: boolean
@@ -4826,6 +5206,56 @@ export interface components {
saved_only?: boolean saved_only?: boolean
q?: string q?: string
} }
PrivateMessage: {
id: number
creator_id: number
recipient_id: number
content: string
deleted: boolean
read: boolean
/**
* Format: datetime
* @example 2025-06-07T02:29:07.980084Z
*/
published: string
/** Format: url */
ap_id: string
local: boolean
}
PrivateMessageView: {
private_message: components['schemas']['PrivateMessage']
creator: components['schemas']['Person']
recipient: components['schemas']['Person']
}
ListPrivateMessagesResponse: {
private_messages: components['schemas']['PrivateMessageView'][]
}
GetPrivateMessageConversationResponse: {
private_messages: components['schemas']['PrivateMessageView'][]
}
CreatePrivateMessageRequest: {
content: string
recipient_id: number
}
PrivateMessageResponse: {
private_message_view: components['schemas']['PrivateMessageView']
}
EditPrivateMessageRequest: {
private_message_id: number
content: string
}
MarkPrivateMessageAsReadRequest: {
private_message_id: number
read: boolean
}
DeletePrivateMessageRequest: {
private_message_id: number
deleted: boolean
}
ReportPrivateMessageRequest: {
private_message_id: number
reason: string
}
} }
responses: { responses: {
/** @description Unprocessable Content */ /** @description Unprocessable Content */
@@ -2,5 +2,5 @@ import type { PaginationCursor } from './schemas'
import type { PostView } from './schemas' import type { PostView } from './schemas'
export interface GetPostsResponse { export interface GetPostsResponse {
posts: Array<PostView> posts: Array<PostView>
next_page?: PaginationCursor next_page: PaginationCursor
} }
+4 -4
View File
@@ -56,7 +56,7 @@ export interface FeedTypes {
{ {
posts: PostView[] posts: PostView[]
next_page?: string next_page?: string
params: GetPosts params: GetPostss & { page_cursor: string }
client: { client: {
itemHeights?: (number | null)[] itemHeights?: (number | null)[]
lastSeen?: number lastSeen?: number
@@ -69,7 +69,7 @@ export interface FeedTypes {
posts: PostView[] posts: PostView[]
community: GetCommunityResponse community: GetCommunityResponse
next_page?: string next_page?: string
params: GetPosts params: GetPosts & { page_cursor: string }
client: { itemHeights?: (number | null)[]; lastSeen?: number } client: { itemHeights?: (number | null)[]; lastSeen?: number }
}, },
] ]
@@ -110,7 +110,7 @@ export interface FeedTypes {
{ {
posts: PostView[] posts: PostView[]
next_page?: string next_page?: string
params: GetPosts params: GetPosts & { page_cursor: string }
feed: Promise<FeedView | undefined> feed: Promise<FeedView | undefined>
client: { client: {
itemHeights?: (number | null)[] itemHeights?: (number | null)[]
@@ -123,7 +123,7 @@ export interface FeedTypes {
{ {
posts: PostView[] posts: PostView[]
next_page?: string next_page?: string
params: GetPosts params: GetPosts & { page_cursor: string }
topic: Promise<TopicView | undefined> topic: Promise<TopicView | undefined>
client: { client: {
itemHeights?: (number | null)[] itemHeights?: (number | null)[]
+8 -5
View File
@@ -14,11 +14,14 @@ export async function load({ url, fetch, route }) {
const listingType: ListingType = const listingType: ListingType =
(url.searchParams.get('type') as ListingType) || settings.defaultSort.feed (url.searchParams.get('type') as ListingType) || settings.defaultSort.feed
const feedData = feed(route.id, async (params) => ({ const feedData = feed(route.id, async (params) => {
...(await client({ func: fetch }).getPosts(params)), const posts = await client({ func: fetch }).getPosts(params)
params: params, return {
client: {}, ...posts,
})).load({ params: { ...params, page_cursor: posts.next_page },
client: {},
}
}).load({
page_cursor: cursor, page_cursor: cursor,
sort: sort, sort: sort,
type_: listingType, type_: listingType,
+3 -3
View File
@@ -51,13 +51,13 @@
</svelte:head> </svelte:head>
<PostListShell <PostListShell
posts={data.posts} bind:posts={data.posts}
cursor={data.next_page} bind:cursor={data.next_page}
bind:client={data.client}
getParams={data.params} getParams={data.params}
params={{ params={{
sort: data.params.sort!, sort: data.params.sort!,
}} }}
client={data.client}
> >
{#snippet extended()} {#snippet extended()}
<CommunityHeader <CommunityHeader
+1 -1
View File
@@ -22,7 +22,7 @@ export async function load({ params, fetch, url, route }) {
community: await communityPromise, community: await communityPromise,
posts: (await postPromise).posts, posts: (await postPromise).posts,
next_page: (await postPromise).next_page, next_page: (await postPromise).next_page,
params: p, params: { ...p, page_cursor: (await postPromise).next_page },
client: {}, client: {},
} }
}).load({ }).load({
+1 -1
View File
@@ -26,9 +26,9 @@
</svelte:head> </svelte:head>
<PostListShell <PostListShell
client={data.client}
posts={data.posts} posts={data.posts}
cursor={data.next_page} cursor={data.next_page}
client={data.client}
getParams={data.params} getParams={data.params}
params={{ params={{
sort: data.params.sort!, sort: data.params.sort!,
+5 -2
View File
@@ -19,10 +19,13 @@ export async function load({ url, fetch, route, params }) {
(i) => i.feeds.find((j) => j.id.toString() == p.feed_id!), (i) => i.feeds.find((j) => j.id.toString() == p.feed_id!),
) )
const postPromise = piefed.getPosts(p)
return { return {
...(await piefed.getPosts(p)), posts: (await postPromise).posts,
next_page: (await postPromise).next_page,
feed: piefedFeedData, feed: piefedFeedData,
params: p, params: { ...p, page_cursor: (await postPromise).next_page },
client: {}, client: {},
} }
}).load({ }).load({
+4 -2
View File
@@ -19,10 +19,12 @@ export async function load({ url, fetch, route, params }) {
include_communities: true, include_communities: true,
}).then((i) => i.topics.find((j) => j.id.toString() == p.topic_id!)) }).then((i) => i.topics.find((j) => j.id.toString() == p.topic_id!))
const posts = await piefed.getPosts(p)
return { return {
...(await piefed.getPosts(p)), ...posts,
topic: piefedTopicData, topic: piefedTopicData,
params: p, params: { ...p, page_cursor: posts.next_page },
client: {}, client: {},
} }
}).load({ }).load({