trithuc-mvc-react 2.9.5 → 2.9.7

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/api/index.js CHANGED
@@ -25,31 +25,17 @@ const api = axios.create({
25
25
  responseType: "json"
26
26
  });
27
27
 
28
- // Hàm để cài đặt token mới
29
- export function setAuthToken(token) {
30
- api.defaults.headers.common["Authorization"] = `Bearer ${token}`;
31
- }
32
-
33
- // Cài đặt token từ localStorage khi khởi tạo
34
28
  const token = storeGetToken();
35
- if (token) {
36
- setAuthToken(token);
37
- }
38
- // Sử dụng interceptor để thêm ngôn ngữ vào headers
39
- api.interceptors.request.use((config) => {
40
- const token = storeGetToken();
41
- const language = storeGetlanguage(); // Lấy ngôn ngữ từ local storage
42
-
43
- if (token) {
44
- config.headers["Authorization"] = `Bearer ${token}`; // Gán token vào headers
45
- }
46
-
47
- if (language) {
48
- config.headers["Accept-Language"] = language; // Gán ngôn ngữ vào headers
49
- }
29
+ if (token) api.defaults.headers.common["Authorization"] = `Bearer ${token}`;
50
30
 
31
+ // Interceptor tối ưu hóa
32
+ api.interceptors.request.use((config) => {
33
+ const language = storeGetlanguage();
34
+ config.headers["Authorization"] = `Bearer ${token}`;
35
+ if (language) config.headers["Accept-Language"] = language;
51
36
  return config;
52
37
  });
38
+
53
39
  export default api;
54
40
 
55
41
  export const getDatasFromTable = async ({ tableName, page, pageSize, data }) => {
@@ -29,7 +29,18 @@ DataManagement.propTypes = {
29
29
  field: PropTypes.string,
30
30
  label: PropTypes.string,
31
31
  placeHolder: PropTypes.string,
32
- type: PropTypes.oneOf(["text", "color", "number", "date", "autocomplete", "checkbox", "radio", "switch"]),
32
+ type: PropTypes.oneOf([
33
+ "text",
34
+ "color",
35
+ "number",
36
+ "date",
37
+ "autocomplete",
38
+ "checkbox",
39
+ "radio",
40
+ "switch",
41
+ "search",
42
+ "default"
43
+ ]),
33
44
  onChangeAfter: PropTypes.func,
34
45
  filters: PropTypes.array
35
46
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trithuc-mvc-react",
3
- "version": "2.9.5",
3
+ "version": "2.9.7",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"