@esvndev/es-react-config-setting 1.0.57 → 1.0.59

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.mjs CHANGED
@@ -18647,6 +18647,7 @@ Input.propTypes = propTypes;
18647
18647
  var Input$1 = Input;
18648
18648
 
18649
18649
  const BASE_URL = process.env.REACT_APP_BASE_URL;
18650
+ const REACT_APP_PRODUCT_CODE = process.env.REACT_APP_PRODUCT_CODE;
18650
18651
  //#region using for token
18651
18652
  const getToken = () => {
18652
18653
  let accessToken = localStorage.getItem('access_token');
@@ -18662,11 +18663,12 @@ const getToken = () => {
18662
18663
  const GetSettingGroup = (callback) => {
18663
18664
  const _url = `${BASE_URL}/api/config/get-setting-config-group`;
18664
18665
  const options = {
18665
- method: 'GET',
18666
+ method: 'POST',
18666
18667
  headers: {
18667
18668
  'Content-Type': 'application/json',
18668
18669
  Authorization: `Bearer ${getToken()}`,
18669
18670
  },
18671
+ body: JSON.stringify({ ModuleId: REACT_APP_PRODUCT_CODE, StateId: '' })
18670
18672
  };
18671
18673
  fetch(_url, options)
18672
18674
  .then(response => {
@@ -18674,12 +18676,12 @@ const GetSettingGroup = (callback) => {
18674
18676
  console.log(`HTTP error! Status: ${response.status}`);
18675
18677
  return null;
18676
18678
  }
18677
- return response.text(); // hoặc .json() nếu muốn object
18679
+ return response.text();
18678
18680
  })
18679
18681
  .then(text => {
18680
18682
  if (text) {
18681
18683
  try {
18682
- JSON.parse(text); // Kiểm tra nếu là JSON hợp lệ
18684
+ JSON.parse(text);
18683
18685
  console.log('Response JSON string:', text);
18684
18686
  }
18685
18687
  catch (err) {
@@ -18711,7 +18713,7 @@ const GetSettingConfig = (callback) => {
18711
18713
  console.log(`HTTP error! Status: ${response.status}`);
18712
18714
  return null;
18713
18715
  }
18714
- return response.text(); // hoặc .json() nếu muốn object
18716
+ return response.text();
18715
18717
  })
18716
18718
  .then(text => {
18717
18719
  if (text) {
@@ -18741,7 +18743,7 @@ const GetSettingConfigByGroup = (obj, callback) => {
18741
18743
  'Content-Type': 'application/json',
18742
18744
  Authorization: `Bearer ${getToken()}`,
18743
18745
  },
18744
- body: JSON.stringify(obj)
18746
+ body: JSON.stringify({ ...obj, ModuleId: REACT_APP_PRODUCT_CODE, StateId: '' })
18745
18747
  };
18746
18748
  fetch(_url, options)
18747
18749
  .then(response => {
@@ -18775,7 +18777,6 @@ const GetSettingConfigByGroup = (obj, callback) => {
18775
18777
  const UpdateSettingConfig = (obj, file, callback) => {
18776
18778
  const _url = `${BASE_URL}/api/config/update-setting-config`;
18777
18779
  const formData = new FormData();
18778
- // Gửi từng item theo dạng Items[0].Key, Items[0].Value...
18779
18780
  obj.Items.forEach((item, index) => {
18780
18781
  formData.append(`Items[${index}].Key`, item.Key);
18781
18782
  formData.append(`Items[${index}].Value`, item.Value);