Added elaborate template switching.
This commit is contained in:
@@ -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,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user