File tree 4 files changed +10
-6
lines changed
4 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import type {
5
5
JwtPayload ,
6
6
ServerGetToken ,
7
7
ServerGetTokenOptions ,
8
+ SessionStatusClaim ,
8
9
SharedSignedInAuthObjectProperties ,
9
10
} from '@clerk/types' ;
10
11
@@ -37,7 +38,7 @@ export type SignedInAuthObject = SharedSignedInAuthObjectProperties & {
37
38
export type SignedOutAuthObject = {
38
39
sessionClaims : null ;
39
40
sessionId : null ;
40
- sessionStatus : null ;
41
+ sessionStatus : SessionStatusClaim | null ;
41
42
actor : null ;
42
43
userId : null ;
43
44
orgId : null ;
@@ -113,11 +114,14 @@ export function signedInAuthObject(
113
114
/**
114
115
* @internal
115
116
*/
116
- export function signedOutAuthObject ( debugData ?: AuthObjectDebugData ) : SignedOutAuthObject {
117
+ export function signedOutAuthObject (
118
+ debugData ?: AuthObjectDebugData ,
119
+ initialSessionStatus ?: SessionStatusClaim ,
120
+ ) : SignedOutAuthObject {
117
121
return {
118
122
sessionClaims : null ,
119
123
sessionId : null ,
120
- sessionStatus : null ,
124
+ sessionStatus : initialSessionStatus ?? null ,
121
125
userId : null ,
122
126
actor : null ,
123
127
orgId : null ,
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ export function signedIn(
102
102
// @ts -expect-error Dynamically return `SignedOutAuthObject` based on options
103
103
toAuth : ( { treatPendingAsSignedOut = true } = { } ) => {
104
104
if ( treatPendingAsSignedOut && authObject . sessionStatus === 'pending' ) {
105
- return signedOutAuthObject ( ) ;
105
+ return signedOutAuthObject ( undefined , authObject . sessionStatus ) ;
106
106
}
107
107
108
108
return authObject ;
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ export const createAsyncGetAuth = ({
53
53
/**
54
54
* Previous known as `createGetAuth`. We needed to create a sync and async variant in order to allow for improvements
55
55
* that required dynamic imports (using `require` would not work).
56
- * It powers the synchronous top-level api `getAuh ()`.
56
+ * It powers the synchronous top-level api `getAuth ()`.
57
57
*/
58
58
export const createSyncGetAuth = ( {
59
59
debugLoggerName,
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ export function getAuthDataFromRequest(
59
59
}
60
60
61
61
if ( treatPendingAsSignedOut && authObject . sessionStatus === 'pending' ) {
62
- authObject = signedOutAuthObject ( options ) ;
62
+ authObject = signedOutAuthObject ( options , authObject . sessionStatus ) ;
63
63
}
64
64
65
65
return authObject ;
You can’t perform that action at this time.
0 commit comments