contentoh-components-library 21.4.31 → 21.4.33

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.
@@ -105,7 +105,7 @@ var SignInLogin = function SignInLogin(props) {
105
105
  }
106
106
 
107
107
  if (!valid) {
108
- _context.next = 32;
108
+ _context.next = 45;
109
109
  break;
110
110
  }
111
111
 
@@ -124,46 +124,52 @@ var SignInLogin = function SignInLogin(props) {
124
124
 
125
125
  props.setUser(session);
126
126
  props.setPaso(8);
127
- _context.next = 25;
127
+ _context.next = 38;
128
128
  break;
129
129
 
130
130
  case 20:
131
131
  userGroup = session.signInUserSession.accessToken.payload["cognito:groups"];
132
- _context.next = 23;
132
+
133
+ if (!userGroup.inclues(props.users)) {
134
+ _context.next = 36;
135
+ break;
136
+ }
137
+
138
+ sessionStorage.setItem("auth", true);
139
+ sessionStorage.setItem("jwt", session.signInUserSession.idToken.jwtToken);
140
+ _context.next = 26;
133
141
  return _axios.default.get(process.env.REACT_APP_USER_ENDPOINT, {
134
142
  headers: {
135
143
  Authorization: session.signInUserSession.idToken.jwtToken
136
144
  }
137
145
  });
138
146
 
139
- case 23:
147
+ case 26:
140
148
  response = _context.sent;
141
-
142
- if (userGroup[0] === props.users) {
143
- sessionStorage.setItem("auth", true);
144
- sessionStorage.setItem("jwt", session.signInUserSession.idToken.jwtToken);
145
- user = JSON.parse(response.data.body).data[0];
146
- company = JSON.parse(response.data.body).data[1];
147
- caches.keys().then(function (names) {
148
- names.forEach(function (name) {
149
- caches.delete(name);
150
- });
149
+ user = JSON.parse(response.data.body).data[0];
150
+ company = JSON.parse(response.data.body).data[1];
151
+ caches.keys().then(function (names) {
152
+ names.forEach(function (name) {
153
+ caches.delete(name);
151
154
  });
152
- user.src = "https://".concat(process.env.REACT_APP_IMAGES_PROFILE_BUCKET, ".s3.amazonaws.com/id-").concat(user.id_user, "/").concat(user.id_user, ".png?").concat(new Date().getTime());
153
- sessionStorage.setItem("user", JSON.stringify(user));
154
- sessionStorage.setItem("company", JSON.stringify(company));
155
- setUpgradePlanRedirect(true);
156
- } else {
157
- setSignInError("NotAuthorizedException");
158
- setLoading(false);
159
- }
155
+ });
156
+ user.src = "https://".concat(process.env.REACT_APP_IMAGES_PROFILE_BUCKET, ".s3.amazonaws.com/id-").concat(user.id_user, "/").concat(user.id_user, ".png?").concat(new Date().getTime());
157
+ sessionStorage.setItem("user", JSON.stringify(user));
158
+ sessionStorage.setItem("company", JSON.stringify(company));
159
+ setUpgradePlanRedirect(true);
160
+ _context.next = 38;
161
+ break;
162
+
163
+ case 36:
164
+ setSignInError("NotAuthorizedException");
165
+ setLoading(false);
160
166
 
161
- case 25:
162
- _context.next = 32;
167
+ case 38:
168
+ _context.next = 45;
163
169
  break;
164
170
 
165
- case 27:
166
- _context.prev = 27;
171
+ case 40:
172
+ _context.prev = 40;
167
173
  _context.t0 = _context["catch"](10);
168
174
  console.log(_context.t0.code);
169
175
  setLoading(false);
@@ -177,12 +183,12 @@ var SignInLogin = function SignInLogin(props) {
177
183
  setSignInError("Error");
178
184
  }
179
185
 
180
- case 32:
186
+ case 45:
181
187
  case "end":
182
188
  return _context.stop();
183
189
  }
184
190
  }
185
- }, _callee, null, [[10, 27]]);
191
+ }, _callee, null, [[10, 40]]);
186
192
  }));
187
193
 
188
194
  return function validate(_x) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.4.31",
3
+ "version": "21.4.33",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -54,20 +54,20 @@ export const SignInLogin = (props) => {
54
54
  } else {
55
55
  const userGroup =
56
56
  session.signInUserSession.accessToken.payload["cognito:groups"];
57
- const response = await axios.get(
58
- process.env.REACT_APP_USER_ENDPOINT,
59
- {
60
- headers: {
61
- Authorization: session.signInUserSession.idToken.jwtToken,
62
- },
63
- }
64
- );
65
- if (userGroup[0] === props.users) {
57
+ if (userGroup.inclues(props.users)) {
66
58
  sessionStorage.setItem("auth", true);
67
59
  sessionStorage.setItem(
68
60
  "jwt",
69
61
  session.signInUserSession.idToken.jwtToken
70
62
  );
63
+ const response = await axios.get(
64
+ process.env.REACT_APP_USER_ENDPOINT,
65
+ {
66
+ headers: {
67
+ Authorization: session.signInUserSession.idToken.jwtToken,
68
+ },
69
+ }
70
+ );
71
71
  const user = JSON.parse(response.data.body).data[0];
72
72
  const company = JSON.parse(response.data.body).data[1];
73
73
  caches.keys().then((names) => {