can sign in and out

This commit is contained in:
Avraham Sakal
2025-09-18 10:05:20 -04:00
parent 6d80d3a9a6
commit 83e3f867dd
6 changed files with 204 additions and 12 deletions
+22
View File
@@ -0,0 +1,22 @@
import type { PageContextServer } from "vike/types";
// This hook is called upon new incoming HTTP requests
export async function onCreatePageContext(pageContext: PageContextServer) {
// // Select the properties you want to make available everywhere
pageContext.user = {
id: pageContext.session?.user?.id,
email: pageContext.session?.user?.email,
};
}
declare global {
namespace Vike {
// We extend PageContext instead of PageContextServer because user is passed to the client
interface PageContext {
user?: {
id: string | null | undefined;
email: string | null | undefined;
};
}
}
}