jclib-ui 1.0.287 → 1.0.290

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.
@@ -4233,6 +4233,7 @@ const initConfig = {
4233
4233
  ident: "",
4234
4234
  loginRoute: "/",
4235
4235
  isProductionMode: true,
4236
+ withCredentials: false,
4236
4237
  getToken: () => "",
4237
4238
  setToken: (token) => console.error(MESSAGE_ERROR, token),
4238
4239
  afterRequest: (_res) => {
@@ -5734,12 +5735,12 @@ function useApi(initialConfig = {}) {
5734
5735
  }
5735
5736
  }
5736
5737
  async function callRequest(localConfig) {
5737
- var _a, _b, _c, _d, _e2;
5738
+ var _a, _b, _c, _d;
5738
5739
  let response;
5739
- let auth = {
5740
- username: (_a = globalApiConfig.auth) == null ? void 0 : _a.username,
5741
- password: (_b = globalApiConfig.auth) == null ? void 0 : _b.password
5742
- };
5740
+ let auth = ((_a = globalApiConfig.auth) == null ? void 0 : _a.username) ? {
5741
+ username: globalApiConfig.auth.username,
5742
+ password: globalApiConfig.auth.password
5743
+ } : void 0;
5743
5744
  initialConfig.headers = { ...initialConfig.headers, ...localConfig == null ? void 0 : localConfig.headers };
5744
5745
  if (globalApiConfig.getToken) {
5745
5746
  let token = globalApiConfig.getToken();
@@ -5757,6 +5758,7 @@ function useApi(initialConfig = {}) {
5757
5758
  baseURL: globalApiConfig.baseURL,
5758
5759
  timeout: globalApiConfig.timeout,
5759
5760
  auth,
5761
+ withCredentials: globalApiConfig.withCredentials,
5760
5762
  validateStatus: (status) => status >= 200 && status < 400,
5761
5763
  ...initialConfig,
5762
5764
  ...localConfig,
@@ -5796,8 +5798,8 @@ function useApi(initialConfig = {}) {
5796
5798
  ...initialRequestInfo,
5797
5799
  isError: true,
5798
5800
  status: err.response.status,
5799
- message: ((_c = err.response.data) == null ? void 0 : _c.error) || err.response.data,
5800
- code: (_d = err.response.data) == null ? void 0 : _d.code
5801
+ message: ((_b = err.response.data) == null ? void 0 : _b.error) || err.response.data,
5802
+ code: (_c = err.response.data) == null ? void 0 : _c.code
5801
5803
  };
5802
5804
  switch (err.response.status) {
5803
5805
  case 400:
@@ -5822,7 +5824,7 @@ function useApi(initialConfig = {}) {
5822
5824
  break;
5823
5825
  }
5824
5826
  case 405: {
5825
- response.message = `Método [${((_e2 = finalConfig.method) == null ? void 0 : _e2.toUpperCase()) || "GET"}] indisponível!`;
5827
+ response.message = `Método [${((_d = finalConfig.method) == null ? void 0 : _d.toUpperCase()) || "GET"}] indisponível!`;
5826
5828
  break;
5827
5829
  }
5828
5830
  case 429: {