@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/cjs/index.js CHANGED
@@ -4827,21 +4827,24 @@ var AddNewUserComponent = function (props) {
4827
4827
  }); };
4828
4828
  var onUpdateUser = function () { return __awaiter(void 0, void 0, void 0, function () {
4829
4829
  var formOneValues, values, response, error_3;
4830
- var _a;
4831
- return __generator(this, function (_b) {
4832
- switch (_b.label) {
4830
+ var _a, _b, _c, _d;
4831
+ return __generator(this, function (_e) {
4832
+ switch (_e.label) {
4833
4833
  case 0:
4834
4834
  setLoading(true);
4835
4835
  formOneValues = formOne.getFieldsValue();
4836
4836
  formOneValues.phoneNo = PhoneInput.formatPhoneNumberIntl(formOneValues.phoneNo);
4837
- _b.label = 1;
4837
+ _e.label = 1;
4838
4838
  case 1:
4839
- _b.trys.push([1, 3, , 4]);
4839
+ _e.trys.push([1, 3, , 4]);
4840
4840
  values = {
4841
4841
  id: (_a = state === null || state === void 0 ? void 0 : state.record) === null || _a === void 0 ? void 0 : _a.id,
4842
4842
  name: formOneValues === null || formOneValues === void 0 ? void 0 : formOneValues.name,
4843
4843
  phoneNo: formOneValues === null || formOneValues === void 0 ? void 0 : formOneValues.phoneNo,
4844
4844
  };
4845
+ if (((_b = state === null || state === void 0 ? void 0 : state.record) === null || _b === void 0 ? void 0 : _b.companyRole) === exports.CompanyRole.MINISTRY) {
4846
+ 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;
4847
+ }
4845
4848
  if (ability.can(Action.Update, classTransformer.plainToClass(User, state === null || state === void 0 ? void 0 : state.record), "role"))
4846
4849
  values.role = formOneValues === null || formOneValues === void 0 ? void 0 : formOneValues.role;
4847
4850
  if (ability.can(Action.Update, classTransformer.plainToClass(User, state === null || state === void 0 ? void 0 : state.record), "email"))
@@ -4849,7 +4852,7 @@ var AddNewUserComponent = function (props) {
4849
4852
  console.log("form one values -- > ", values, state.record);
4850
4853
  return [4 /*yield*/, put("national/user/update", values)];
4851
4854
  case 2:
4852
- response = _b.sent();
4855
+ response = _e.sent();
4853
4856
  if (response.status === 200 || response.status === 201) {
4854
4857
  antd.message.open({
4855
4858
  type: "success",
@@ -4863,7 +4866,7 @@ var AddNewUserComponent = function (props) {
4863
4866
  }
4864
4867
  return [3 /*break*/, 4];
4865
4868
  case 3:
4866
- error_3 = _b.sent();
4869
+ error_3 = _e.sent();
4867
4870
  console.log("Error in user update", error_3);
4868
4871
  antd.message.open({
4869
4872
  type: "error",