diff --git a/src/runtime/server/utils/session.ts b/src/runtime/server/utils/session.ts index f91a198d..d04ef9c4 100644 --- a/src/runtime/server/utils/session.ts +++ b/src/runtime/server/utils/session.ts @@ -3,7 +3,7 @@ import { useSession, createError } from 'h3' import { defu } from 'defu' import { createHooks } from 'hookable' import { useRuntimeConfig } from '#imports' -import type { User, UserSession } from '#auth-utils' +import type { UserSession, UserSessionRequired } from '#auth-utils' export interface SessionHooks { /** @@ -11,7 +11,7 @@ export interface SessionHooks { * - Add extra properties to the session * - Throw an error if the session could not be verified (with a database for example) */ - 'fetch': (session: UserSession, event: H3Event) => void | Promise + 'fetch': (session: UserSessionRequired, event: H3Event) => void | Promise /** * Called before clearing the session */ @@ -59,7 +59,7 @@ export async function clearUserSession (event: H3Event) { return true } -export async function requireUserSession(event: H3Event): Promise { +export async function requireUserSession(event: H3Event): Promise { const userSession = await getUserSession(event) if (!userSession.user) { @@ -69,7 +69,7 @@ export async function requireUserSession(event: H3Event): Promise user: ComputedRef