feat: add feed
This commit is contained in:
@@ -90,6 +90,10 @@ export type Post = {
|
||||
pinned_comment?: Comment | null;
|
||||
/** Total comments + replies on the post (drives the footer comment count). */
|
||||
comments_count?: number;
|
||||
/** Home-feed only: does the viewer follow this post's author (accepted)? */
|
||||
viewer_follows_author?: boolean;
|
||||
/** Home-feed only: does the author follow the viewer (drives "Follow back")? */
|
||||
author_follows_viewer?: boolean;
|
||||
};
|
||||
|
||||
/** A comment or reply on a post. Threading is one level deep: `parent_id` is
|
||||
@@ -541,6 +545,31 @@ export const profile = {
|
||||
},
|
||||
};
|
||||
|
||||
// ─── Home feed (global, personalised) ──────────────────────────────────────
|
||||
|
||||
export const feed = {
|
||||
/** One page of the global home feed (auth required). Returns at most
|
||||
* `limit` posts; callers infer "more" from a full page. */
|
||||
home(limit = 10, offset = 0) {
|
||||
const qs = new URLSearchParams({
|
||||
limit: String(limit),
|
||||
offset: String(offset),
|
||||
});
|
||||
return call<Post[]>(`/feed?${qs}`);
|
||||
},
|
||||
/** Up to 5 accounts that joined in the last 24h — the feed's discovery
|
||||
* strip. Empty array when there are none. */
|
||||
newUsers() {
|
||||
return call<UserSummary[]>(`/feed/new-users`);
|
||||
},
|
||||
/** Clear the server-side "seen" set so the feed starts fresh. Called on
|
||||
* logout and on page unload; `keepalive` lets the request outlive the
|
||||
* unloading page (like a beacon). */
|
||||
reset() {
|
||||
return call<void>(`/feed/reset`, { method: "POST", keepalive: true });
|
||||
},
|
||||
};
|
||||
|
||||
// ─── Relationships (follow / block / report) ───────────────────────────────
|
||||
|
||||
/** Allowed user-report categories — mirrors the BFF allow-list. */
|
||||
|
||||
Reference in New Issue
Block a user