adds profile timeline and follows
This commit is contained in:
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user