Added elaborate template switching.

This commit is contained in:
2024-08-26 06:15:22 +02:00
parent fa991c0294
commit 80d8a8109a
29 changed files with 617 additions and 180 deletions

View File

@@ -1,6 +1,7 @@
import { render } from 'vike/abort'; /* eslint-disable-line import/extensions */
import { fetchUser } from '#/src/users.js';
import { fetchUserStashes } from '#/src/stashes.js';
import { fetchAlerts } from '#/src/alerts.js';
export async function onBeforeRender(pageContext) {
@@ -15,11 +16,14 @@ export async function onBeforeRender(pageContext) {
throw render(404, `Cannot find user '${pageContext.routeParams.username}'.`);
}
const stashes = await fetchUserStashes(profile.id, pageContext.user);
return {
pageContext: {
title: profile.username,
pageProps: {
profile, // differentiate from authed 'user'
stashes,
alerts,
},
},