@undp/carbon-library 1.0.49 → 1.0.50

Sign up to get free protection for your applications and to get access to all the features.
package/dist/esm/index.js CHANGED
@@ -4807,21 +4807,24 @@ var AddNewUserComponent = function (props) {
4807
4807
  }); };
4808
4808
  var onUpdateUser = function () { return __awaiter(void 0, void 0, void 0, function () {
4809
4809
  var formOneValues, values, response, error_3;
4810
- var _a;
4811
- return __generator(this, function (_b) {
4812
- switch (_b.label) {
4810
+ var _a, _b, _c, _d;
4811
+ return __generator(this, function (_e) {
4812
+ switch (_e.label) {
4813
4813
  case 0:
4814
4814
  setLoading(true);
4815
4815
  formOneValues = formOne.getFieldsValue();
4816
4816
  formOneValues.phoneNo = formatPhoneNumberIntl(formOneValues.phoneNo);
4817
- _b.label = 1;
4817
+ _e.label = 1;
4818
4818
  case 1:
4819
- _b.trys.push([1, 3, , 4]);
4819
+ _e.trys.push([1, 3, , 4]);
4820
4820
  values = {
4821
4821
  id: (_a = state === null || state === void 0 ? void 0 : state.record) === null || _a === void 0 ? void 0 : _a.id,
4822
4822
  name: formOneValues === null || formOneValues === void 0 ? void 0 : formOneValues.name,
4823
4823
  phoneNo: formOneValues === null || formOneValues === void 0 ? void 0 : formOneValues.phoneNo,
4824
4824
  };
4825
+ if (((_b = state === null || state === void 0 ? void 0 : state.record) === null || _b === void 0 ? void 0 : _b.companyRole) === CompanyRole$1.MINISTRY) {
4826
+ values.sectoralScope = (_d = (_c = state === null || state === void 0 ? void 0 : state.record) === null || _c === void 0 ? void 0 : _c.company) === null || _d === void 0 ? void 0 : _d.sectoralScope;
4827
+ }
4825
4828
  if (ability.can(Action.Update, plainToClass(User, state === null || state === void 0 ? void 0 : state.record), "role"))
4826
4829
  values.role = formOneValues === null || formOneValues === void 0 ? void 0 : formOneValues.role;
4827
4830
  if (ability.can(Action.Update, plainToClass(User, state === null || state === void 0 ? void 0 : state.record), "email"))
@@ -4829,7 +4832,7 @@ var AddNewUserComponent = function (props) {
4829
4832
  console.log("form one values -- > ", values, state.record);
4830
4833
  return [4 /*yield*/, put("national/user/update", values)];
4831
4834
  case 2:
4832
- response = _b.sent();
4835
+ response = _e.sent();
4833
4836
  if (response.status === 200 || response.status === 201) {
4834
4837
  message.open({
4835
4838
  type: "success",
@@ -4843,7 +4846,7 @@ var AddNewUserComponent = function (props) {
4843
4846
  }
4844
4847
  return [3 /*break*/, 4];
4845
4848
  case 3:
4846
- error_3 = _b.sent();
4849
+ error_3 = _e.sent();
4847
4850
  console.log("Error in user update", error_3);
4848
4851
  message.open({
4849
4852
  type: "error",