in nuxt, where do i specify the context's types?
export default defineEventHandler(async (event) => {
const config = useRuntimeConfig();
const session_id = getCookie(event, 'session_id');
let ctx: SessionContext | null = null;
if (session_id) {
const s: SessionContext = await validateSession(session_id);
if (s.user === null) {
deleteCookie(event, 'session');
}
}
// how do i access this within my nuxt app?
// this is only on the server side right?
event.context.session = ctx;
if (!ctx && config.authRoutes.includes(event.path)) {
sendRedirect(event, '/login', 302);
}
});export default defineEventHandler(async (event) => {
const config = useRuntimeConfig();
const session_id = getCookie(event, 'session_id');
let ctx: SessionContext | null = null;
if (session_id) {
const s: SessionContext = await validateSession(session_id);
if (s.user === null) {
deleteCookie(event, 'session');
}
}
// how do i access this within my nuxt app?
// this is only on the server side right?
event.context.session = ctx;
if (!ctx && config.authRoutes.includes(event.path)) {
sendRedirect(event, '/login', 302);
}
});in nuxt, where do i specify the context's types?