File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,11 @@ export const sessionHooks = createHooks<SessionHooks>()
28
28
* @returns The user session
29
29
*/
30
30
export async function getUserSession ( event : UseSessionEvent ) {
31
- return ( await _useSession ( event ) ) . data
31
+ const session = await _useSession ( event )
32
+ return {
33
+ id : session . id ,
34
+ ...session . data ,
35
+ }
32
36
}
33
37
/**
34
38
* Set a user session
Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ export interface SecureSessionData {
7
7
}
8
8
9
9
export interface UserSession {
10
+ /**
11
+ * Session ID
12
+ */
13
+ id : string
10
14
/**
11
15
* User session data, available on client and server
12
16
*/
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ describe('ssr', async () => {
24
24
it ( 'returns an empty session' , async ( ) => {
25
25
// Get response to a server-rendered page with `$fetch`.
26
26
const session = await $fetch ( '/api/_auth/session' )
27
- expect ( session ) . toStrictEqual ( { } )
27
+ // Session should be an object with an `id` property
28
+ expect ( session ) . toBeInstanceOf ( Object )
29
+ expect ( session ) . toHaveProperty ( 'id' )
28
30
} )
29
31
} )
You can’t perform that action at this time.
0 commit comments