@itilite/iui-user-management 0.4.53 → 0.4.54

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.
@@ -1575,6 +1575,7 @@ var createUser = function createUser(payload) {
1575
1575
  return new Promise(function (resolve, reject) {
1576
1576
  api$2.post(userAddEditUrl.createUser(), formatCreateUserPayload(payload)).then(function (res) {
1577
1577
  if (res.data.status === true) {
1578
+ IUIToastMessageService$1.sNotify(res.data.message);
1578
1579
  resolve(res.data);
1579
1580
  } else {
1580
1581
  if (res.data.errors && typeof res.data.errors === 'object') {
@@ -1725,6 +1726,7 @@ var updateUser = function updateUser(payload, userId, inputChangeLog) {
1725
1726
  return new Promise(function (resolve, reject) {
1726
1727
  api$2.put(userAddEditUrl.editUser(userId), formatUpdateUserPayload(payload, inputChangeLog)).then(function (res) {
1727
1728
  if (res.data.status === true) {
1729
+ IUIToastMessageService$1.sNotify(res.data.message);
1728
1730
  resolve(res.data);
1729
1731
  } else {
1730
1732
  if (!Object.keys(res.data.errors).length) {
@@ -5264,7 +5266,12 @@ var UserAddEdit = function UserAddEdit(props) {
5264
5266
  }).then(function (response) {
5265
5267
  return response.json();
5266
5268
  }).then(function (res) {
5267
- dispatch(setCardsDetails(res));
5269
+ var _res$roles;
5270
+ if (res !== null && res !== void 0 && (_res$roles = res.roles) !== null && _res$roles !== void 0 && _res$roles.length) {
5271
+ dispatch(setCardsDetails(res));
5272
+ } else {
5273
+ IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
5274
+ }
5268
5275
  })["catch"](function (error) {
5269
5276
  console.log("errorrr", error);
5270
5277
  });
@@ -5279,7 +5286,12 @@ var UserAddEdit = function UserAddEdit(props) {
5279
5286
  }).then(function (response) {
5280
5287
  return response.json();
5281
5288
  }).then(function (res) {
5282
- dispatch(setCardsDetails(res));
5289
+ var _res$roles2;
5290
+ if (res !== null && res !== void 0 && (_res$roles2 = res.roles) !== null && _res$roles2 !== void 0 && _res$roles2.length) {
5291
+ dispatch(setCardsDetails(res));
5292
+ } else {
5293
+ IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
5294
+ }
5283
5295
  })["catch"](function (error) {
5284
5296
  console.log("errorrr", error);
5285
5297
  });
@@ -6527,17 +6539,20 @@ var UserAddEdit = function UserAddEdit(props) {
6527
6539
  'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
6528
6540
  }
6529
6541
  }).then(function (response) {
6530
- return response.json();
6531
- }).then(function (res) {
6532
- updateUserApiCall(payload, inputChangeLog);
6542
+ if (response.status === 200) {
6543
+ updateUserApiCall(payload, inputChangeLog);
6544
+ } else {
6545
+ IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
6546
+ }
6533
6547
  })["catch"](function (error) {
6534
6548
  console.log("errorrr", error);
6549
+ })["finally"](function () {
6550
+ dispatch(stopLoader());
6535
6551
  });
6536
6552
  } else {
6537
6553
  updateUserApiCall(payload, inputChangeLog);
6538
6554
  }
6539
6555
  } else {
6540
- dispatch(showLoader());
6541
6556
  dispatch(showLoader());
6542
6557
  if (cardApiflag === true) {
6543
6558
  fetch(userAddEditUrl.cardsEditUserDetails(isEditMode ? editUserId : id), {
@@ -6548,11 +6563,15 @@ var UserAddEdit = function UserAddEdit(props) {
6548
6563
  'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
6549
6564
  }
6550
6565
  }).then(function (response) {
6551
- return response.json();
6552
- }).then(function (res) {
6553
- createUserApiCall(payload);
6566
+ if (response.status === 200) {
6567
+ createUserApiCall(payload);
6568
+ } else {
6569
+ IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
6570
+ }
6554
6571
  })["catch"](function (error) {
6555
6572
  console.log("errorrr", error);
6573
+ })["finally"](function () {
6574
+ dispatch(stopLoader());
6556
6575
  });
6557
6576
  } else {
6558
6577
  createUserApiCall(payload);