oidc-jwt-client
Advanced tools
Comparing version 4.0.18-develop.4 to 4.0.18-develop.5
@@ -6,2 +6,4 @@ 'use strict'; | ||
var zustand = require('zustand'); | ||
var constants = require('./constants.js'); | ||
var storage = require('./storage.js'); | ||
var store = require('./store.js'); | ||
@@ -58,2 +60,12 @@ require('./utils/errors.js'); | ||
var store$1 = React.useRef(store.createOidcJwtClientStore(client, removeTokenFromUrlFunction)).current; | ||
React.useEffect(function () { | ||
var initialState = { | ||
userInfo: storage.Storage.get(constants.USER_INFO_TOKEN_STORAGE_KEY), | ||
csrfToken: storage.Storage.get(constants.CSRF_TOKEN_STORAGE_KEY), | ||
isLoggedIn: !!storage.Storage.get(constants.LOGGED_IN_TOKEN_STORAGE_KEY), | ||
isInitialized: !client, | ||
didRetryLogin: storage.Storage.get(constants.RETRY_LOGIN_STORAGE_KEY) === 1, | ||
}; | ||
store$1.setState({ authState: initialState }); | ||
}, [client, store$1]); | ||
return (React__default.default.createElement(OidcJwtContext.Provider, { value: store$1 }, | ||
@@ -60,0 +72,0 @@ React__default.default.createElement(OidcJwtInitializer, tslib_es6.__assign({}, props), children))); |
'use strict'; | ||
var zustand = require('zustand'); | ||
var constants = require('./constants.js'); | ||
var storage = require('./storage.js'); | ||
var AuthService = require('./utils/AuthService.js'); | ||
@@ -11,7 +9,7 @@ | ||
var initialState = { | ||
userInfo: storage.Storage.get(constants.USER_INFO_TOKEN_STORAGE_KEY), | ||
csrfToken: storage.Storage.get(constants.CSRF_TOKEN_STORAGE_KEY), | ||
isLoggedIn: !!storage.Storage.get(constants.LOGGED_IN_TOKEN_STORAGE_KEY), | ||
userInfo: undefined, | ||
csrfToken: null, | ||
isLoggedIn: false, | ||
isInitialized: !client, | ||
didRetryLogin: storage.Storage.get(constants.RETRY_LOGIN_STORAGE_KEY) === 1, | ||
didRetryLogin: false, | ||
}; | ||
@@ -18,0 +16,0 @@ var service = client |
import { __assign } from './node_modules/tslib/tslib.es6.js'; | ||
import React, { createContext, useContext, useRef, useState, useEffect } from 'react'; | ||
import React, { createContext, useContext, useRef, useEffect, useState } from 'react'; | ||
import { useStore } from 'zustand'; | ||
import { USER_INFO_TOKEN_STORAGE_KEY, CSRF_TOKEN_STORAGE_KEY, LOGGED_IN_TOKEN_STORAGE_KEY, RETRY_LOGIN_STORAGE_KEY } from './constants.js'; | ||
import { Storage } from './storage.js'; | ||
import { createOidcJwtClientStore } from './store.js'; | ||
@@ -51,2 +53,12 @@ import './utils/errors.js'; | ||
var store = useRef(createOidcJwtClientStore(client, removeTokenFromUrlFunction)).current; | ||
useEffect(function () { | ||
var initialState = { | ||
userInfo: Storage.get(USER_INFO_TOKEN_STORAGE_KEY), | ||
csrfToken: Storage.get(CSRF_TOKEN_STORAGE_KEY), | ||
isLoggedIn: !!Storage.get(LOGGED_IN_TOKEN_STORAGE_KEY), | ||
isInitialized: !client, | ||
didRetryLogin: Storage.get(RETRY_LOGIN_STORAGE_KEY) === 1, | ||
}; | ||
store.setState({ authState: initialState }); | ||
}, [client, store]); | ||
return (React.createElement(OidcJwtContext.Provider, { value: store }, | ||
@@ -53,0 +65,0 @@ React.createElement(OidcJwtInitializer, __assign({}, props), children))); |
import { create } from 'zustand'; | ||
import { USER_INFO_TOKEN_STORAGE_KEY, CSRF_TOKEN_STORAGE_KEY, LOGGED_IN_TOKEN_STORAGE_KEY, RETRY_LOGIN_STORAGE_KEY } from './constants.js'; | ||
import { Storage } from './storage.js'; | ||
import { AuthService } from './utils/AuthService.js'; | ||
@@ -9,7 +7,7 @@ | ||
var initialState = { | ||
userInfo: Storage.get(USER_INFO_TOKEN_STORAGE_KEY), | ||
csrfToken: Storage.get(CSRF_TOKEN_STORAGE_KEY), | ||
isLoggedIn: !!Storage.get(LOGGED_IN_TOKEN_STORAGE_KEY), | ||
userInfo: undefined, | ||
csrfToken: null, | ||
isLoggedIn: false, | ||
isInitialized: !client, | ||
didRetryLogin: Storage.get(RETRY_LOGIN_STORAGE_KEY) === 1, | ||
didRetryLogin: false, | ||
}; | ||
@@ -16,0 +14,0 @@ var service = client |
{ | ||
"name": "oidc-jwt-client", | ||
"version": "4.0.18-develop.4", | ||
"version": "4.0.18-develop.5", | ||
"description": "Fetch JWTs for API access from oidc-jwt-provider", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
171357
1647