diff --git a/src/utils/session.ts b/src/utils/session.ts index ddd4cc0c..0362910a 100644 --- a/src/utils/session.ts +++ b/src/utils/session.ts @@ -63,9 +63,9 @@ export async function useSession( await updateSession(event, config, update); return sessionManager; }, - clear: async () => { - await clearSession(event, config); - return sessionManager; + clear: () => { + clearSession(event, config); + return Promise.resolve(sessionManager); }, }; return sessionManager; @@ -234,16 +234,17 @@ export async function unsealSession( /** * Clear the session data for the current request. */ -export async function clearSession( +export function clearSession( event: H3Event, config: Partial, -) { +): Promise { const sessionName = config.name || DEFAULT_NAME; if (event.context.sessions?.[sessionName]) { delete event.context.sessions![sessionName]; } - await setCookie(event, sessionName, "", { + setCookie(event, sessionName, "", { ...DEFAULT_COOKIE, ...config.cookie, }); + return Promise.resolve(); }