@esvndev/es-react-config-setting 1.0.77 → 1.0.79

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
@@ -18698,7 +18698,7 @@ const GetSettingGroup = (callback) => {
18698
18698
  callback({ status: false, data: error });
18699
18699
  });
18700
18700
  };
18701
- const GetSettingConfigClient = (callback) => {
18701
+ const GetSettingConfigClient = async (callback) => {
18702
18702
  const _url = `${BASE_URL}/api/config/get-setting-config-client`;
18703
18703
  const _obj = {
18704
18704
  ModuleId: REACT_APP_PRODUCT_CODE,
@@ -18713,7 +18713,7 @@ const GetSettingConfigClient = (callback) => {
18713
18713
  },
18714
18714
  body: JSON.stringify(_obj)
18715
18715
  };
18716
- fetch(_url, options)
18716
+ await fetch(_url, options)
18717
18717
  .then(response => {
18718
18718
  if (!response.ok) {
18719
18719
  console.log(`HTTP error! Status: ${response.status}`);
@@ -19001,12 +19001,15 @@ const VARIABLE_FRIVATE = {
19001
19001
  let intervalId = null;
19002
19002
  var TIME_RELOAD = 15000;
19003
19003
  //Load interval data default
19004
- const INIT_CONFIG_SETTING = () => {
19004
+ const INIT_CONFIG_SETTING = async () => {
19005
19005
  _LOAD_(null);
19006
19006
  if (intervalId) {
19007
19007
  clearInterval(intervalId);
19008
19008
  intervalId = null;
19009
19009
  }
19010
+ if (!localStorage.getItem("app_config_setting_version")) {
19011
+ await _FETCH_AND_UPDATE();
19012
+ }
19010
19013
  intervalId = setInterval(() => {
19011
19014
  _FETCH_AND_UPDATE();
19012
19015
  }, TIME_RELOAD);
@@ -19064,8 +19067,8 @@ const get_conf = (key, type) => {
19064
19067
  }
19065
19068
  return _;
19066
19069
  };
19067
- const _FETCH_AND_UPDATE = () => {
19068
- GetSettingConfigClient((data) => {
19070
+ const _FETCH_AND_UPDATE = async () => {
19071
+ await GetSettingConfigClient((data) => {
19069
19072
  try {
19070
19073
  if (data?.isupdatetime) {
19071
19074
  TIME_RELOAD = (data?.timeupdate < 5000 || data?.timeupdate > 300000) ? 5000 : data?.timeupdate;