This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / web / src / routes / timeline / +page.ts
945 B 26 lines
1import { createBobbinClient } from "$lib/api/client"; 2import { jsonGet } from "$lib/api/_request"; 3import { toHttpError } from "$lib/api/load"; 4import type * as ShTangledFeedGetTimeline from "$lib/api/lexicons/types/sh/tangled/feed/getTimeline"; 5import type { PageLoad } from "./$types"; 6 7const PAGE_LIMIT = 50; 8 9export const load: PageLoad = async (event) => { 10 const parent = await event.parent(); 11 const ctx = createBobbinClient({ serviceUrl: parent.publicConfig.bobbinUrl, fetch: event.fetch }); 12 const viewer = parent.auth?.did; 13 14 const followingOnly = event.url.searchParams.get("following") === "true" && viewer !== undefined; 15 16 try { 17 const { feed } = await jsonGet<ShTangledFeedGetTimeline.$output>( 18 ctx, 19 "sh.tangled.feed.getTimeline", 20 { viewer, followingOnly, limit: PAGE_LIMIT } 21 ); 22 return { feed, followingOnly, signedIn: viewer !== undefined }; 23 } catch (cause) { 24 toHttpError(cause, "Could not load timeline"); 25 } 26};