oidc-react
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -164,2 +164,5 @@ "use strict"; | ||
}); }, [userManager, onSignIn]); | ||
/** | ||
* Handles user auth flow on initial render. | ||
*/ | ||
(0, react_1.useEffect)(function () { | ||
@@ -174,3 +177,4 @@ isMountedRef.current = true; | ||
user = _a.sent(); | ||
if (!(!user && (0, exports.hasCodeInUrl)(location))) return [3 /*break*/, 3]; | ||
if (!(!user || user.expired)) return [3 /*break*/, 6]; | ||
if (!(0, exports.hasCodeInUrl)(location)) return [3 /*break*/, 3]; | ||
return [4 /*yield*/, userManager.signinCallback()]; | ||
@@ -182,5 +186,5 @@ case 2: | ||
onSignIn && onSignIn(user_1); | ||
return [2 /*return*/]; | ||
return [3 /*break*/, 5]; | ||
case 3: | ||
if (!((!user || user.expired) && autoSignIn)) return [3 /*break*/, 5]; | ||
if (!autoSignIn) return [3 /*break*/, 5]; | ||
state = onBeforeSignIn ? onBeforeSignIn() : undefined; | ||
@@ -190,4 +194,5 @@ return [4 /*yield*/, userManager.signinRedirect(__assign(__assign({}, autoSignInArgs), { state: state }))]; | ||
_a.sent(); | ||
return [3 /*break*/, 6]; | ||
case 5: | ||
_a.label = 5; | ||
case 5: return [3 /*break*/, 7]; | ||
case 6: | ||
if (isMountedRef.current) { | ||
@@ -197,4 +202,4 @@ setUserData(user); | ||
} | ||
_a.label = 6; | ||
case 6: return [2 /*return*/]; | ||
_a.label = 7; | ||
case 7: return [2 /*return*/]; | ||
} | ||
@@ -214,3 +219,3 @@ }); | ||
}; | ||
var onSilentRenewError = function (error) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onSilentRenewError = function () { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
@@ -217,0 +222,0 @@ switch (_a.label) { |
@@ -6,2 +6,9 @@ # Changelog | ||
## [3.0.3](https://github.com/bjerkio/oidc-react/compare/v3.0.2...v3.0.3) (2023-03-16) | ||
### Bug Fixes | ||
* handle both null user and user.expired when autoSignIn is disabled ([#977](https://github.com/bjerkio/oidc-react/issues/977)) ([1a95930](https://github.com/bjerkio/oidc-react/commit/1a9593060f902ae89880fb6bfd076bb24fbac8ab)) | ||
## [3.0.2](https://github.com/bjerkio/oidc-react/compare/v3.0.1...v3.0.2) (2023-03-12) | ||
@@ -8,0 +15,0 @@ |
{ | ||
"name": "oidc-react", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"private": false, | ||
@@ -31,7 +31,7 @@ "description": "", | ||
"@types/faker": "6.6.9", | ||
"@types/jest": "29.4.0", | ||
"@types/node": "18.15.0", | ||
"@types/jest": "29.4.2", | ||
"@types/node": "18.15.3", | ||
"@types/react": "18.0.28", | ||
"@typescript-eslint/eslint-plugin": "5.54.1", | ||
"@typescript-eslint/parser": "5.54.1", | ||
"@typescript-eslint/eslint-plugin": "5.55.0", | ||
"@typescript-eslint/parser": "5.55.0", | ||
"bundlewatch": "0.3.3", | ||
@@ -38,0 +38,0 @@ "eslint": "8.36.0", |
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
49777
564