can sign in and out
This commit is contained in:
@@ -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;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user