Skip to content

Commit

Permalink
feat(session): add generated session id
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Feb 5, 2025
1 parent 1e99757 commit f6cd01a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/runtime/server/utils/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export const sessionHooks = createHooks<SessionHooks>()
* @returns The user session
*/
export async function getUserSession(event: UseSessionEvent) {
return (await _useSession(event)).data
const session = await _useSession(event)
return {
id: session.id,
...session.data,
}
}
/**
* Set a user session
Expand Down
4 changes: 4 additions & 0 deletions src/runtime/types/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export interface SecureSessionData {
}

export interface UserSession {
/**
* Session ID
*/
id: string
/**
* User session data, available on client and server
*/
Expand Down

0 comments on commit f6cd01a

Please sign in to comment.