@nibssplc/cams-sdk-react 0.0.1-beta.37 → 0.0.1-beta.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +15 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +15 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -17349,11 +17349,23 @@ function CAMSMSALProviderInner(_a) {
|
|
|
17349
17349
|
var _this = this;
|
|
17350
17350
|
var children = _a.children, authOptions = __rest(_a, ["children"]);
|
|
17351
17351
|
var auth = useCAMSMSALAuth(authOptions);
|
|
17352
|
-
var
|
|
17352
|
+
var getInitialProfile = function () {
|
|
17353
|
+
if (typeof window === "undefined") {
|
|
17354
|
+
return null;
|
|
17355
|
+
}
|
|
17356
|
+
try {
|
|
17357
|
+
var storedProfile = localStorage.getItem(profileStorageKey);
|
|
17358
|
+
return storedProfile ? JSON.parse(storedProfile) : null;
|
|
17359
|
+
}
|
|
17360
|
+
catch (_a) {
|
|
17361
|
+
return null;
|
|
17362
|
+
}
|
|
17363
|
+
};
|
|
17364
|
+
var _b = React__default.useState(getInitialProfile), userProfile = _b[0], setUserProfile = _b[1];
|
|
17353
17365
|
var profileStorageKey = "".concat(auth.storageKey, "-PROFILE");
|
|
17354
17366
|
// Load profile from storage on mount
|
|
17355
17367
|
React__default.useEffect(function () {
|
|
17356
|
-
if (typeof window !== "undefined"
|
|
17368
|
+
if (typeof window !== "undefined") {
|
|
17357
17369
|
var storedProfile = localStorage.getItem(profileStorageKey);
|
|
17358
17370
|
if (storedProfile) {
|
|
17359
17371
|
try {
|
|
@@ -17362,7 +17374,7 @@ function CAMSMSALProviderInner(_a) {
|
|
|
17362
17374
|
catch (_a) { }
|
|
17363
17375
|
}
|
|
17364
17376
|
}
|
|
17365
|
-
}, [profileStorageKey
|
|
17377
|
+
}, [profileStorageKey]);
|
|
17366
17378
|
// Persist tokens and profile
|
|
17367
17379
|
React__default.useEffect(function () {
|
|
17368
17380
|
if (auth.accessToken &&
|