@esvndev/es-react-config-setting 1.0.39 → 1.0.41

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
@@ -11484,12 +11484,15 @@ const GetSettingGroup = (callback) => {
11484
11484
  catch (err) {
11485
11485
  console.log('Invalid JSON:', err);
11486
11486
  }
11487
+ callback({ status: true, data: JSON.parse(text) });
11488
+ }
11489
+ else {
11490
+ callback({ status: false, data: text });
11487
11491
  }
11488
- callback({ state: true, data: text });
11489
11492
  })
11490
11493
  .catch(error => {
11491
11494
  console.log('Fetch error:', error);
11492
- callback({ state: true, data: error });
11495
+ callback({ status: false, data: error });
11493
11496
  });
11494
11497
  };
11495
11498
 
@@ -11505,8 +11508,6 @@ const SettingApp = (props) => {
11505
11508
  const [windowSize, setWindowSize] = React.useState(getWindowSize());
11506
11509
  //Cho phép tự đóng hoặc không
11507
11510
  const [backdrop, setBackdrop] = React.useState(true);
11508
- React.useEffect(() => {
11509
- }, []);
11510
11511
  //Sự kiện đóng/mở cài đặt
11511
11512
  const handleModal = () => {
11512
11513
  if (eventClose)
@@ -11527,10 +11528,17 @@ const SettingApp = (props) => {
11527
11528
  const [dataSettingGroup, setDataSettingGroup] = React.useState([]);
11528
11529
  //Load data of group config and setting by group
11529
11530
  React.useEffect(() => {
11530
- GetSettingGroup((data) => {
11531
- setDataSettingGroup(data);
11532
- });
11533
- }, []);
11531
+ if (isOpen) {
11532
+ GetSettingGroup((data) => {
11533
+ if (data.status) {
11534
+ setDataSettingGroup(data.data);
11535
+ }
11536
+ else {
11537
+ setDataSettingGroup([]);
11538
+ }
11539
+ });
11540
+ }
11541
+ }, [isOpen]);
11534
11542
  //Sự kiện chọn nhóm cài đặt
11535
11543
  const switchSettingTab = (data) => {
11536
11544
  const updated = dataSettingGroup.map((item) => ({