@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/index.js CHANGED
@@ -2072,25 +2072,31 @@ var AsgardeoProvider = ({
2072
2072
  schemas: []
2073
2073
  });
2074
2074
  } else {
2075
- try {
2076
- const fetchedUser = await asgardeo.getUser({ baseUrl: resolvedBaseUrl });
2077
- setUser(fetchedUser);
2078
- } catch (error) {
2079
- }
2080
- try {
2081
- const fetchedUserProfile = await asgardeo.getUserProfile({ baseUrl: resolvedBaseUrl });
2082
- setUserProfile(fetchedUserProfile);
2083
- } catch (error) {
2084
- }
2085
- try {
2086
- const fetchedOrganization = await asgardeo.getCurrentOrganization();
2087
- setCurrentOrganization(fetchedOrganization);
2088
- } catch (error) {
2075
+ const shouldFetchUserProfile = preferences?.user?.fetchUserProfile !== false;
2076
+ if (shouldFetchUserProfile) {
2077
+ try {
2078
+ const fetchedUser = await asgardeo.getUser({ baseUrl: resolvedBaseUrl });
2079
+ setUser(fetchedUser);
2080
+ } catch (error) {
2081
+ }
2082
+ try {
2083
+ const fetchedUserProfile = await asgardeo.getUserProfile({ baseUrl: resolvedBaseUrl });
2084
+ setUserProfile(fetchedUserProfile);
2085
+ } catch (error) {
2086
+ }
2089
2087
  }
2090
- try {
2091
- const fetchedMyOrganizations = await asgardeo.getMyOrganizations();
2092
- setMyOrganizations(fetchedMyOrganizations);
2093
- } catch (error) {
2088
+ const shouldFetchOrganizations = preferences?.user?.fetchOrganizations !== false;
2089
+ if (shouldFetchOrganizations) {
2090
+ try {
2091
+ const fetchedOrganization = await asgardeo.getCurrentOrganization();
2092
+ setCurrentOrganization(fetchedOrganization);
2093
+ } catch (error) {
2094
+ }
2095
+ try {
2096
+ const fetchedMyOrganizations = await asgardeo.getMyOrganizations();
2097
+ setMyOrganizations(fetchedMyOrganizations);
2098
+ } catch (error) {
2099
+ }
2094
2100
  }
2095
2101
  }
2096
2102
  const currentSignInStatus = await asgardeo.isSignedIn();