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