@asgardeo/react 0.16.2 → 0.17.0

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/cjs/index.js CHANGED
@@ -2188,25 +2188,31 @@ var AsgardeoProvider = ({
2188
2188
  schemas: []
2189
2189
  });
2190
2190
  } else {
2191
- try {
2192
- const fetchedUser = await asgardeo.getUser({ baseUrl: resolvedBaseUrl });
2193
- setUser(fetchedUser);
2194
- } catch (error) {
2195
- }
2196
- try {
2197
- const fetchedUserProfile = await asgardeo.getUserProfile({ baseUrl: resolvedBaseUrl });
2198
- setUserProfile(fetchedUserProfile);
2199
- } catch (error) {
2200
- }
2201
- try {
2202
- const fetchedOrganization = await asgardeo.getCurrentOrganization();
2203
- setCurrentOrganization(fetchedOrganization);
2204
- } catch (error) {
2191
+ const shouldFetchUserProfile = preferences?.user?.fetchUserProfile !== false;
2192
+ if (shouldFetchUserProfile) {
2193
+ try {
2194
+ const fetchedUser = await asgardeo.getUser({ baseUrl: resolvedBaseUrl });
2195
+ setUser(fetchedUser);
2196
+ } catch (error) {
2197
+ }
2198
+ try {
2199
+ const fetchedUserProfile = await asgardeo.getUserProfile({ baseUrl: resolvedBaseUrl });
2200
+ setUserProfile(fetchedUserProfile);
2201
+ } catch (error) {
2202
+ }
2205
2203
  }
2206
- try {
2207
- const fetchedMyOrganizations = await asgardeo.getMyOrganizations();
2208
- setMyOrganizations(fetchedMyOrganizations);
2209
- } catch (error) {
2204
+ const shouldFetchOrganizations = preferences?.user?.fetchOrganizations !== false;
2205
+ if (shouldFetchOrganizations) {
2206
+ try {
2207
+ const fetchedOrganization = await asgardeo.getCurrentOrganization();
2208
+ setCurrentOrganization(fetchedOrganization);
2209
+ } catch (error) {
2210
+ }
2211
+ try {
2212
+ const fetchedMyOrganizations = await asgardeo.getMyOrganizations();
2213
+ setMyOrganizations(fetchedMyOrganizations);
2214
+ } catch (error) {
2215
+ }
2210
2216
  }
2211
2217
  }
2212
2218
  const currentSignInStatus = await asgardeo.isSignedIn();