@itilite/iui-user-management 1.4.71 → 1.4.72

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
@@ -5278,21 +5278,36 @@ var Membership = function Membership(_ref) {
5278
5278
  name: membershipName || ''
5279
5279
  };
5280
5280
  setIsUpdating(true);
5281
- var _temp2 = _finallyRethrows(function () {
5281
+ var _temp4 = _finallyRethrows(function () {
5282
5282
  return _catch(function () {
5283
- return Promise.resolve(editIndex ? api$7.put(url, payload) : api$7.post(url, payload)).then(function (response) {
5284
- if ((response === null || response === void 0 ? void 0 : response.status) === 201 || (response === null || response === void 0 ? void 0 : response.status) === 200) {
5285
- var _response$data3;
5286
- var updatedResponse = response === null || response === void 0 ? void 0 : response.data;
5283
+ function _temp3() {
5284
+ var _response, _response2;
5285
+ if (((_response = response) === null || _response === void 0 ? void 0 : _response.status) === 201 || ((_response2 = response) === null || _response2 === void 0 ? void 0 : _response2.status) === 200) {
5286
+ var _response3;
5287
+ var updatedResponse = (_response3 = response) === null || _response3 === void 0 ? void 0 : _response3.data;
5287
5288
  updatedResponse.program_name = selectedMembershipChain === null || selectedMembershipChain === void 0 ? void 0 : selectedMembershipChain.program_name;
5288
5289
  updatedResponse.loyalty_program_image_url = selectedMembershipChain === null || selectedMembershipChain === void 0 ? void 0 : selectedMembershipChain.loyalty_program_image_url;
5289
5290
  if (isOtherMembership) updatedResponse.loyalty_program_name = 'Other';
5290
- updateList(response === null || response === void 0 ? void 0 : (_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : _response$data3.membership_type, editIndex, updatedResponse);
5291
- IUIToastMessageService$5.sNotify(editIndex ? "Membership updated." : "New membership added.");
5291
+ updateList(type, editIndex, updatedResponse);
5292
+ if (!userID) IUIToastMessageService$5.sNotify(editIndex ? "Membership updated." : "New membership added.");
5292
5293
  } else {
5293
5294
  IUIToastMessageService$5.warningNotify('Failed to save membership');
5294
5295
  }
5295
- });
5296
+ }
5297
+ var response = {};
5298
+ var _temp2 = function () {
5299
+ if (!userID) {
5300
+ return Promise.resolve(editIndex ? api$7.put(url, payload) : api$7.post(url, payload)).then(function (_api$put) {
5301
+ response = _api$put;
5302
+ });
5303
+ } else {
5304
+ response = {
5305
+ data: payload,
5306
+ status: 200
5307
+ };
5308
+ }
5309
+ }();
5310
+ return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
5296
5311
  }, function (error) {
5297
5312
  console.error(error);
5298
5313
  IUIToastMessageService$5.warningNotify('Something went wrong!');
@@ -5302,7 +5317,7 @@ var Membership = function Membership(_ref) {
5302
5317
  if (_wasThrown) throw _result;
5303
5318
  return _result;
5304
5319
  });
5305
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
5320
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
5306
5321
  } catch (e) {
5307
5322
  return Promise.reject(e);
5308
5323
  }