adds profile timeline and follows

This commit is contained in:
Christian Beutel
2024-12-14 21:14:02 +01:00
parent e315c4d58a
commit b0d136ccea
27 changed files with 635 additions and 36 deletions

View File

@@ -1,3 +1,4 @@
import { follows_a_b, follows_counts, follows_index } from "$lib/stores/follow_store";
import { users_show } from "$lib/stores/user_store";
import { error, type ServerLoad } from "@sveltejs/kit";
import { ClientResponseError } from "pocketbase";
@@ -10,10 +11,13 @@ export const load: ServerLoad = async ({ params, locals, fetch }) => {
try {
const user = await users_show(params.id, fetch);
const isOwnProfile = params.id === locals.user?.id;
return { user, isOwnProfile }
const follow = await follows_a_b(locals.user?.id, params.id, fetch) ?? null
const followCounts = await follows_counts(params.id, fetch)
return { user, isOwnProfile, ...followCounts, follow: follow }
} catch (e) {
if (e instanceof ClientResponseError && e.status == 404) {
error(404, {