Skip to content

Commit

Permalink
fix: UserSession secure type augmentation (#181)
Browse files Browse the repository at this point in the history
* fix: UserSession secure type augmentation

* docs: add readme example
  • Loading branch information
IsraelOrtuno committed Sep 19, 2024
1 parent 23ccd4c commit 125ea11
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ declare module '#auth-utils' {
interface UserSession {
// Add your own fields
}

interface SecureSessionData {
// Add your own fields
}
}

export {}
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export type { User, UserSession, UserSessionRequired, UserSessionComposable } from './session'
export type { User, UserSession, UserSessionRequired, UserSessionComposable, SecureSessionData } from './session'
export type { OAuthConfig, OAuthProvider, OnError } from './oauth-config'
5 changes: 4 additions & 1 deletion src/runtime/types/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import type { ComputedRef, Ref } from 'vue'
export interface User {
}

export interface SecureSessionData {
}

export interface UserSession {
/**
* User session data, available on client and server
Expand All @@ -11,7 +14,7 @@ export interface UserSession {
/**
* Private session data, only available on server/ code
*/
secure?: Record<string, unknown>
secure?: SecureSessionData
/**
* Extra session data, available on client and server
*/
Expand Down

0 comments on commit 125ea11

Please sign in to comment.