@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.esm.js
CHANGED
|
@@ -17330,11 +17330,23 @@ function CAMSMSALProviderInner(_a) {
|
|
|
17330
17330
|
var _this = this;
|
|
17331
17331
|
var children = _a.children, authOptions = __rest(_a, ["children"]);
|
|
17332
17332
|
var auth = useCAMSMSALAuth(authOptions);
|
|
17333
|
-
var
|
|
17333
|
+
var getInitialProfile = function () {
|
|
17334
|
+
if (typeof window === "undefined") {
|
|
17335
|
+
return null;
|
|
17336
|
+
}
|
|
17337
|
+
try {
|
|
17338
|
+
var storedProfile = localStorage.getItem(profileStorageKey);
|
|
17339
|
+
return storedProfile ? JSON.parse(storedProfile) : null;
|
|
17340
|
+
}
|
|
17341
|
+
catch (_a) {
|
|
17342
|
+
return null;
|
|
17343
|
+
}
|
|
17344
|
+
};
|
|
17345
|
+
var _b = useState(getInitialProfile), userProfile = _b[0], setUserProfile = _b[1];
|
|
17334
17346
|
var profileStorageKey = "".concat(auth.storageKey, "-PROFILE");
|
|
17335
17347
|
// Load profile from storage on mount
|
|
17336
17348
|
useEffect(function () {
|
|
17337
|
-
if (typeof window !== "undefined"
|
|
17349
|
+
if (typeof window !== "undefined") {
|
|
17338
17350
|
var storedProfile = localStorage.getItem(profileStorageKey);
|
|
17339
17351
|
if (storedProfile) {
|
|
17340
17352
|
try {
|
|
@@ -17343,7 +17355,7 @@ function CAMSMSALProviderInner(_a) {
|
|
|
17343
17355
|
catch (_a) { }
|
|
17344
17356
|
}
|
|
17345
17357
|
}
|
|
17346
|
-
}, [profileStorageKey
|
|
17358
|
+
}, [profileStorageKey]);
|
|
17347
17359
|
// Persist tokens and profile
|
|
17348
17360
|
useEffect(function () {
|
|
17349
17361
|
if (auth.accessToken &&
|