oidc-jwt-client
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -260,2 +260,8 @@ import { createContext, useMemo, useEffect, createElement, useState, useContext } from 'react'; | ||
} | ||
function useAuthSessionInfo() { | ||
var client = useAuthClient(); | ||
if (!client) | ||
return null; | ||
return { hasSession: client.hasSessionToken() }; | ||
} | ||
function useAuthAccessToken() { | ||
@@ -274,3 +280,3 @@ var client = useAuthClient(); | ||
export { OidcJwtProvider, oidcJwtClient, useAuthAccessClaims, useAuthAccessToken, useAuthControls, useAuthUserInfo, usePromiseResult }; | ||
export { OidcJwtProvider, oidcJwtClient, useAuthAccessClaims, useAuthAccessToken, useAuthControls, useAuthSessionInfo, useAuthUserInfo, usePromiseResult }; | ||
//# sourceMappingURL=index.es.js.map |
@@ -264,2 +264,8 @@ 'use strict'; | ||
} | ||
function useAuthSessionInfo() { | ||
var client = useAuthClient(); | ||
if (!client) | ||
return null; | ||
return { hasSession: client.hasSessionToken() }; | ||
} | ||
function useAuthAccessToken() { | ||
@@ -283,4 +289,5 @@ var client = useAuthClient(); | ||
exports.useAuthControls = useAuthControls; | ||
exports.useAuthSessionInfo = useAuthSessionInfo; | ||
exports.useAuthUserInfo = useAuthUserInfo; | ||
exports.usePromiseResult = usePromiseResult; | ||
//# sourceMappingURL=index.js.map |
@@ -22,4 +22,7 @@ import * as React from 'react'; | ||
export declare function useAuthAccessClaims(): Record<string, unknown> | null; | ||
export declare function useAuthSessionInfo(): { | ||
hasSession: boolean; | ||
} | null; | ||
export declare function useAuthAccessToken(): { | ||
(): Promise<string | null>; | ||
}; |
{ | ||
"name": "oidc-jwt-client", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Fetch JWTs for API access from oidc-jwt-provider", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -67,2 +67,10 @@ # oidc-jwt-client | ||
console.log('This are the claims: ', claims) | ||
``` | ||
### Check session | ||
To check if there is a session and for example show a loader when there's not yet one: | ||
```javascript | ||
const sessionInfo = useAuthSessionInfo(); | ||
console.log('There is a session started: ', sessionInfo.hasSession) | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54962
652
75