@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.mjs CHANGED
@@ -11457,12 +11457,15 @@ const GetSettingGroup = (callback) => {
11457
11457
  catch (err) {
11458
11458
  console.log('Invalid JSON:', err);
11459
11459
  }
11460
+ callback({ status: true, data: JSON.parse(text) });
11461
+ }
11462
+ else {
11463
+ callback({ status: false, data: text });
11460
11464
  }
11461
- callback({ state: true, data: text });
11462
11465
  })
11463
11466
  .catch(error => {
11464
11467
  console.log('Fetch error:', error);
11465
- callback({ state: true, data: error });
11468
+ callback({ status: false, data: error });
11466
11469
  });
11467
11470
  };
11468
11471
 
@@ -11478,8 +11481,6 @@ const SettingApp = (props) => {
11478
11481
  const [windowSize, setWindowSize] = useState(getWindowSize());
11479
11482
  //Cho phép tự đóng hoặc không
11480
11483
  const [backdrop, setBackdrop] = useState(true);
11481
- useEffect(() => {
11482
- }, []);
11483
11484
  //Sự kiện đóng/mở cài đặt
11484
11485
  const handleModal = () => {
11485
11486
  if (eventClose)
@@ -11500,10 +11501,17 @@ const SettingApp = (props) => {
11500
11501
  const [dataSettingGroup, setDataSettingGroup] = useState([]);
11501
11502
  //Load data of group config and setting by group
11502
11503
  useEffect(() => {
11503
- GetSettingGroup((data) => {
11504
- setDataSettingGroup(data);
11505
- });
11506
- }, []);
11504
+ if (isOpen) {
11505
+ GetSettingGroup((data) => {
11506
+ if (data.status) {
11507
+ setDataSettingGroup(data.data);
11508
+ }
11509
+ else {
11510
+ setDataSettingGroup([]);
11511
+ }
11512
+ });
11513
+ }
11514
+ }, [isOpen]);
11507
11515
  //Sự kiện chọn nhóm cài đặt
11508
11516
  const switchSettingTab = (data) => {
11509
11517
  const updated = dataSettingGroup.map((item) => ({