adds activity timeline

This commit is contained in:
Christian Beutel
2024-12-14 17:42:00 +01:00
parent 85729e9728
commit e315c4d58a
19 changed files with 1452 additions and 15 deletions

View File

@@ -1,15 +1,26 @@
import { users_show } from "$lib/stores/user_store";
import { error, type ServerLoad } from "@sveltejs/kit";
import { ClientResponseError } from "pocketbase";
export const load: ServerLoad = async ({ params, locals, fetch }) => {
if(!params.id) {
if (!params.id) {
error(404, "Not found")
}
const user = await users_show(params.id, fetch);
try {
const user = await users_show(params.id, fetch);
const isOwnProfile = params.id === locals.user?.id;
const isOwnProfile = params.id === locals.user?.id;
return { user, isOwnProfile }
} catch (e) {
if (e instanceof ClientResponseError && e.status == 404) {
error(404, {
message: 'Not found'
});
}
throw e
}
return { user, isOwnProfile }
};