@esvndev/es-react-config-setting 1.0.78 → 1.0.80

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.
@@ -1,4 +1,4 @@
1
1
  import { key_format } from "../../shared/type";
2
2
  export declare const GLOBAL_WINDOW_VARIABLE: Record<string, any>;
3
- export declare const INIT_CONFIG_SETTING: () => void;
3
+ export declare const INIT_CONFIG_SETTING: () => Promise<void>;
4
4
  export declare const get_conf: (key: string, type?: key_format) => any;
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ type key_format = 'text' | 'int' | 'decimal' | 'byte' | 'object';
9
9
 
10
10
  declare const SettingApp: (props: ISettingApp) => react_jsx_runtime.JSX.Element;
11
11
 
12
- declare const INIT_CONFIG_SETTING: () => void;
12
+ declare const INIT_CONFIG_SETTING: () => Promise<void>;
13
13
  declare const get_conf: (key: string, type?: key_format) => any;
14
14
 
15
15
  export { INIT_CONFIG_SETTING, SettingApp, get_conf };
package/dist/index.js CHANGED
@@ -18688,7 +18688,7 @@ const getToken = () => {
18688
18688
  };
18689
18689
  //#endregion
18690
18690
  const GetSettingGroup = (callback) => {
18691
- const _url = `${BASE_URL}/api/config/get-setting-config-group`;
18691
+ const _url = `${BASE_URL}/api/escore/get-setting-config-group`;
18692
18692
  const options = {
18693
18693
  method: 'POST',
18694
18694
  headers: {
@@ -18725,8 +18725,8 @@ const GetSettingGroup = (callback) => {
18725
18725
  callback({ status: false, data: error });
18726
18726
  });
18727
18727
  };
18728
- const GetSettingConfigClient = (callback) => {
18729
- const _url = `${BASE_URL}/api/config/get-setting-config-client`;
18728
+ const GetSettingConfigClient = async (callback) => {
18729
+ const _url = `${BASE_URL}/api/escore/get-setting-config-client`;
18730
18730
  const _obj = {
18731
18731
  ModuleId: REACT_APP_PRODUCT_CODE,
18732
18732
  StateId: '',
@@ -18740,7 +18740,7 @@ const GetSettingConfigClient = (callback) => {
18740
18740
  },
18741
18741
  body: JSON.stringify(_obj)
18742
18742
  };
18743
- fetch(_url, options)
18743
+ await fetch(_url, options)
18744
18744
  .then(response => {
18745
18745
  if (!response.ok) {
18746
18746
  console.log(`HTTP error! Status: ${response.status}`);
@@ -18769,7 +18769,7 @@ const GetSettingConfigClient = (callback) => {
18769
18769
  });
18770
18770
  };
18771
18771
  const GetSettingConfigByGroup = (obj, callback) => {
18772
- const _url = `${BASE_URL}/api/config/get-setting-config-by-group`;
18772
+ const _url = `${BASE_URL}/api/escore/get-setting-config-by-group`;
18773
18773
  const options = {
18774
18774
  method: 'POST',
18775
18775
  headers: {
@@ -18807,7 +18807,7 @@ const GetSettingConfigByGroup = (obj, callback) => {
18807
18807
  };
18808
18808
  //Update setting data
18809
18809
  const UpdateSettingConfig = (obj, file, callback) => {
18810
- const _url = `${BASE_URL}/api/config/update-setting-config`;
18810
+ const _url = `${BASE_URL}/api/escore/update-setting-config`;
18811
18811
  const formData = new FormData();
18812
18812
  formData.append(`GroupId`, obj.GroupId);
18813
18813
  formData.append(`ModuleId`, REACT_APP_PRODUCT_CODE ?? "");
@@ -19028,12 +19028,15 @@ const VARIABLE_FRIVATE = {
19028
19028
  let intervalId = null;
19029
19029
  var TIME_RELOAD = 15000;
19030
19030
  //Load interval data default
19031
- const INIT_CONFIG_SETTING = () => {
19031
+ const INIT_CONFIG_SETTING = async () => {
19032
19032
  _LOAD_(null);
19033
19033
  if (intervalId) {
19034
19034
  clearInterval(intervalId);
19035
19035
  intervalId = null;
19036
19036
  }
19037
+ if (!localStorage.getItem("app_config_setting_version")) {
19038
+ await _FETCH_AND_UPDATE();
19039
+ }
19037
19040
  intervalId = setInterval(() => {
19038
19041
  _FETCH_AND_UPDATE();
19039
19042
  }, TIME_RELOAD);
@@ -19091,8 +19094,8 @@ const get_conf = (key, type) => {
19091
19094
  }
19092
19095
  return _;
19093
19096
  };
19094
- const _FETCH_AND_UPDATE = () => {
19095
- GetSettingConfigClient((data) => {
19097
+ const _FETCH_AND_UPDATE = async () => {
19098
+ await GetSettingConfigClient((data) => {
19096
19099
  try {
19097
19100
  if (data?.isupdatetime) {
19098
19101
  TIME_RELOAD = (data?.timeupdate < 5000 || data?.timeupdate > 300000) ? 5000 : data?.timeupdate;