@esvndev/es-react-config-setting 1.0.57 → 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);