@esvndev/es-react-config-setting 1.0.56 → 1.0.58

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
@@ -18674,6 +18674,7 @@ Input.propTypes = propTypes;
18674
18674
  var Input$1 = Input;
18675
18675
 
18676
18676
  const BASE_URL = process.env.REACT_APP_BASE_URL;
18677
+ const REACT_APP_PRODUCT_CODE = process.env.REACT_APP_PRODUCT_CODE;
18677
18678
  //#region using for token
18678
18679
  const getToken = () => {
18679
18680
  let accessToken = localStorage.getItem('access_token');
@@ -18689,10 +18690,11 @@ const getToken = () => {
18689
18690
  const GetSettingGroup = (callback) => {
18690
18691
  const _url = `${BASE_URL}/api/config/get-setting-config-group`;
18691
18692
  const options = {
18692
- method: 'GET',
18693
+ method: 'POST',
18693
18694
  headers: {
18694
18695
  'Content-Type': 'application/json',
18695
18696
  Authorization: `Bearer ${getToken()}`,
18697
+ body: JSON.stringify({ ModuleId: REACT_APP_PRODUCT_CODE, StateId: '' })
18696
18698
  },
18697
18699
  };
18698
18700
  fetch(_url, options)
@@ -18701,12 +18703,12 @@ const GetSettingGroup = (callback) => {
18701
18703
  console.log(`HTTP error! Status: ${response.status}`);
18702
18704
  return null;
18703
18705
  }
18704
- return response.text(); // hoặc .json() nếu muốn object
18706
+ return response.text();
18705
18707
  })
18706
18708
  .then(text => {
18707
18709
  if (text) {
18708
18710
  try {
18709
- JSON.parse(text); // Kiểm tra nếu là JSON hợp lệ
18711
+ JSON.parse(text);
18710
18712
  console.log('Response JSON string:', text);
18711
18713
  }
18712
18714
  catch (err) {
@@ -18738,7 +18740,7 @@ const GetSettingConfig = (callback) => {
18738
18740
  console.log(`HTTP error! Status: ${response.status}`);
18739
18741
  return null;
18740
18742
  }
18741
- return response.text(); // hoặc .json() nếu muốn object
18743
+ return response.text();
18742
18744
  })
18743
18745
  .then(text => {
18744
18746
  if (text) {
@@ -18768,7 +18770,7 @@ const GetSettingConfigByGroup = (obj, callback) => {
18768
18770
  'Content-Type': 'application/json',
18769
18771
  Authorization: `Bearer ${getToken()}`,
18770
18772
  },
18771
- body: JSON.stringify(obj)
18773
+ body: JSON.stringify({ ...obj, ModuleId: REACT_APP_PRODUCT_CODE, StateId: '' })
18772
18774
  };
18773
18775
  fetch(_url, options)
18774
18776
  .then(response => {
@@ -18802,7 +18804,6 @@ const GetSettingConfigByGroup = (obj, callback) => {
18802
18804
  const UpdateSettingConfig = (obj, file, callback) => {
18803
18805
  const _url = `${BASE_URL}/api/config/update-setting-config`;
18804
18806
  const formData = new FormData();
18805
- // Gửi từng item theo dạng Items[0].Key, Items[0].Value...
18806
18807
  obj.Items.forEach((item, index) => {
18807
18808
  formData.append(`Items[${index}].Key`, item.Key);
18808
18809
  formData.append(`Items[${index}].Value`, item.Value);
@@ -18923,7 +18924,7 @@ const SettingApp = (props) => {
18923
18924
  monthly_target_defects: null,
18924
18925
  allowed_defects_per_model_day: null
18925
18926
  }).current;
18926
- //Cấu hình số lỗi mục tiêu cho phép cho 1 model trong 1 ngày
18927
+ //Cấu hình thông số delay tránh gửi liên tục
18927
18928
  const change_save = (obj, e) => {
18928
18929
  const _m = saveSettings;
18929
18930
  if (saveSettings && _m[obj.id] !== null) {
@@ -18936,7 +18937,8 @@ const SettingApp = (props) => {
18936
18937
  }));
18937
18938
  const _data = {
18938
18939
  id: crypto.randomUUID(),
18939
- key: obj,
18940
+ obj: obj,
18941
+ key: obj.id,
18940
18942
  value: value,
18941
18943
  };
18942
18944
  _m[obj.id] = setTimeout(() => {