trithuc-mvc-react 2.9.4 → 2.9.6

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 }) => {
@@ -247,7 +247,7 @@ const DataTable = ({ multipleActions = [], page, setPage = () => {}, disableEdit
247
247
  multipleActions={multipleActions}
248
248
  />
249
249
 
250
- <Table className="border" size={downXL ? "small" : "medium"}>
250
+ <Table size={downXL ? "small" : "medium"}>
251
251
  <TableHead
252
252
  headLabel={columns}
253
253
  onSelectAllClick={handleSelectAllClick}
@@ -29,7 +29,7 @@ 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(["text", "color", "number", "date", "autocomplete", "checkbox", "radio", "switch", "search"]),
33
33
  onChangeAfter: PropTypes.func,
34
34
  filters: PropTypes.array
35
35
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trithuc-mvc-react",
3
- "version": "2.9.4",
3
+ "version": "2.9.6",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"