@itilite/iui-user-management 0.4.53 → 0.4.55

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
@@ -1578,6 +1578,7 @@ var createUser = function createUser(payload) {
1578
1578
  return new Promise(function (resolve, reject) {
1579
1579
  api$2.post(userAddEditUrl.createUser(), formatCreateUserPayload(payload)).then(function (res) {
1580
1580
  if (res.data.status === true) {
1581
+ IUIToastMessageService$1.sNotify(res.data.message);
1581
1582
  resolve(res.data);
1582
1583
  } else {
1583
1584
  if (res.data.errors && typeof res.data.errors === 'object') {
@@ -1728,6 +1729,7 @@ var updateUser = function updateUser(payload, userId, inputChangeLog) {
1728
1729
  return new Promise(function (resolve, reject) {
1729
1730
  api$2.put(userAddEditUrl.editUser(userId), formatUpdateUserPayload(payload, inputChangeLog)).then(function (res) {
1730
1731
  if (res.data.status === true) {
1732
+ IUIToastMessageService$1.sNotify(res.data.message);
1731
1733
  resolve(res.data);
1732
1734
  } else {
1733
1735
  if (!Object.keys(res.data.errors).length) {
@@ -5267,7 +5269,12 @@ var UserAddEdit = function UserAddEdit(props) {
5267
5269
  }).then(function (response) {
5268
5270
  return response.json();
5269
5271
  }).then(function (res) {
5270
- dispatch(setCardsDetails(res));
5272
+ var _res$roles;
5273
+ if (res !== null && res !== void 0 && (_res$roles = res.roles) !== null && _res$roles !== void 0 && _res$roles.length) {
5274
+ dispatch(setCardsDetails(res));
5275
+ } else {
5276
+ IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
5277
+ }
5271
5278
  })["catch"](function (error) {
5272
5279
  console.log("errorrr", error);
5273
5280
  });
@@ -5282,7 +5289,12 @@ var UserAddEdit = function UserAddEdit(props) {
5282
5289
  }).then(function (response) {
5283
5290
  return response.json();
5284
5291
  }).then(function (res) {
5285
- dispatch(setCardsDetails(res));
5292
+ var _res$roles2;
5293
+ if (res !== null && res !== void 0 && (_res$roles2 = res.roles) !== null && _res$roles2 !== void 0 && _res$roles2.length) {
5294
+ dispatch(setCardsDetails(res));
5295
+ } else {
5296
+ IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
5297
+ }
5286
5298
  })["catch"](function (error) {
5287
5299
  console.log("errorrr", error);
5288
5300
  });
@@ -5462,7 +5474,7 @@ var UserAddEdit = function UserAddEdit(props) {
5462
5474
  var role = _step.value;
5463
5475
  var splitRoleval = role.value.split(":");
5464
5476
  var defaultRole = splitRoleval[2];
5465
- if (defaultRole === 'card_holder') {
5477
+ if (defaultRole === 'card-holder') {
5466
5478
  setCardsRole(role.value);
5467
5479
  break;
5468
5480
  }
@@ -5485,7 +5497,7 @@ var UserAddEdit = function UserAddEdit(props) {
5485
5497
  var role = _step3.value;
5486
5498
  var splitRoleval = role.value.split(":");
5487
5499
  var defaultRole = splitRoleval[2];
5488
- if (defaultRole === 'card_holder') {
5500
+ if (defaultRole === 'card-holder') {
5489
5501
  setCardsRole(role.value);
5490
5502
  break;
5491
5503
  }
@@ -6530,17 +6542,20 @@ var UserAddEdit = function UserAddEdit(props) {
6530
6542
  'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
6531
6543
  }
6532
6544
  }).then(function (response) {
6533
- return response.json();
6534
- }).then(function (res) {
6535
- updateUserApiCall(payload, inputChangeLog);
6545
+ if (response.status === 200) {
6546
+ updateUserApiCall(payload, inputChangeLog);
6547
+ } else {
6548
+ IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
6549
+ }
6536
6550
  })["catch"](function (error) {
6537
6551
  console.log("errorrr", error);
6552
+ })["finally"](function () {
6553
+ dispatch(stopLoader());
6538
6554
  });
6539
6555
  } else {
6540
6556
  updateUserApiCall(payload, inputChangeLog);
6541
6557
  }
6542
6558
  } else {
6543
- dispatch(showLoader());
6544
6559
  dispatch(showLoader());
6545
6560
  if (cardApiflag === true) {
6546
6561
  fetch(userAddEditUrl.cardsEditUserDetails(isEditMode ? editUserId : id), {
@@ -6551,11 +6566,15 @@ var UserAddEdit = function UserAddEdit(props) {
6551
6566
  'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
6552
6567
  }
6553
6568
  }).then(function (response) {
6554
- return response.json();
6555
- }).then(function (res) {
6556
- createUserApiCall(payload);
6569
+ if (response.status === 200) {
6570
+ createUserApiCall(payload);
6571
+ } else {
6572
+ IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
6573
+ }
6557
6574
  })["catch"](function (error) {
6558
6575
  console.log("errorrr", error);
6576
+ })["finally"](function () {
6577
+ dispatch(stopLoader());
6559
6578
  });
6560
6579
  } else {
6561
6580
  createUserApiCall(payload);