Skip to content

Commit

Permalink
feat!: call fetch hook if session is not empty instead of user defi…
Browse files Browse the repository at this point in the history
…ned (atinux#188)
  • Loading branch information
atinux committed Sep 25, 2024
1 parent 9560e60 commit 3bd9c3b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/runtime/server/api/session.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import type { UserSessionRequired } from '#auth-utils'
export default eventHandler(async (event) => {
const session = await getUserSession(event)

if (session.user) {
// If session is not empty, call fetch hook
if (Object.keys(session).length > 0) {
await sessionHooks.callHookParallel('fetch', session as UserSessionRequired, event)
}

Expand Down

0 comments on commit 3bd9c3b

Please sign in to comment.