aq-fe-framework 0.1.201 → 0.1.202

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,7 +1,7 @@
1
1
  import {
2
2
  baseAxios_default,
3
3
  useQ_AQ_GetAQModule
4
- } from "./chunk-J76K4YUA.mjs";
4
+ } from "./chunk-QR4NSLBN.mjs";
5
5
  import {
6
6
  createGenericStore
7
7
  } from "./chunk-Y3YGC5IH.mjs";
@@ -3,23 +3,37 @@ import { useQueryClient } from "@tanstack/react-query";
3
3
 
4
4
  // src/api/baseAxios.ts
5
5
  import axios from "axios";
6
- var baseAxios = axios.create({
7
- baseURL: process.env.NEXT_PUBLIC_API
8
- });
6
+ var baseAxios = axios.create();
7
+ (async function loadConfig() {
8
+ try {
9
+ const response = await fetch("/config.json");
10
+ if (response.ok) {
11
+ const data = await response.json();
12
+ if (data.baseURL) {
13
+ baseAxios.defaults.baseURL = data.baseURL;
14
+ console.log("\u2705 baseURL set to:", data.baseURL);
15
+ } else {
16
+ console.warn("\u26A0\uFE0F baseURL kh\xF4ng c\xF3 trong config.json");
17
+ }
18
+ } else {
19
+ console.error("\u274C Kh\xF4ng load \u0111\u01B0\u1EE3c config.json");
20
+ }
21
+ } catch (error) {
22
+ console.error("\u274C L\u1ED7i khi t\u1EA3i config.json", error);
23
+ }
24
+ })();
9
25
  baseAxios.interceptors.request.use(
10
26
  (config) => {
11
27
  var _a, _b;
12
28
  const tokenData = localStorage.getItem("useS_authenticate");
13
- const state = JSON.parse(tokenData);
29
+ const state = tokenData ? JSON.parse(tokenData) : null;
14
30
  const token = (_b = (_a = state == null ? void 0 : state.state) == null ? void 0 : _a.state) == null ? void 0 : _b.token;
15
31
  if (token) {
16
32
  config.headers.Authorization = `Bearer ${token}`;
17
33
  }
18
34
  return config;
19
35
  },
20
- (error) => {
21
- return Promise.reject(error);
22
- }
36
+ (error) => Promise.reject(error)
23
37
  );
24
38
  var baseAxios_default = baseAxios;
25
39
 
@@ -66,8 +66,8 @@ import {
66
66
  useS_BasicAppShell,
67
67
  useS_ButtonImport,
68
68
  utils_layout_getItemsWithoutLinks
69
- } from "../chunk-BQSJZ3WA.mjs";
70
- import "../chunk-J76K4YUA.mjs";
69
+ } from "../chunk-KTGRWET4.mjs";
70
+ import "../chunk-QR4NSLBN.mjs";
71
71
  import "../chunk-Y3YGC5IH.mjs";
72
72
  import "../chunk-5U2JSHSJ.mjs";
73
73
  import "../chunk-7ZCOFATU.mjs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useQ_AQ_GetAQModule
3
- } from "../chunk-J76K4YUA.mjs";
3
+ } from "../chunk-QR4NSLBN.mjs";
4
4
  import "../chunk-7ZCOFATU.mjs";
5
5
  import "../chunk-FWCSY2DS.mjs";
6
6
  export {
@@ -25,12 +25,12 @@ import {
25
25
  useS_BasicAppShell,
26
26
  useS_authenticate,
27
27
  utils_layout_getItemsWithoutLinks
28
- } from "../chunk-BQSJZ3WA.mjs";
28
+ } from "../chunk-KTGRWET4.mjs";
29
29
  import {
30
30
  baseAxios_default,
31
31
  useQ_AQ_GetAQModule,
32
32
  useQ_SkillCenter_GetAll
33
- } from "../chunk-J76K4YUA.mjs";
33
+ } from "../chunk-QR4NSLBN.mjs";
34
34
  import {
35
35
  createGenericStore
36
36
  } from "../chunk-Y3YGC5IH.mjs";
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "types": "./dist/hooks/index.d.mts"
23
23
  }
24
24
  },
25
- "version": "0.1.201",
25
+ "version": "0.1.202",
26
26
  "private": false,
27
27
  "files": [
28
28
  "dist"