trithuc-mvc-react 2.6.6 → 2.6.8
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
|
@@ -77,11 +77,7 @@ export const getDataFromTable = async ({ tableName, id }) => {
|
|
|
77
77
|
return res.data;
|
|
78
78
|
} else {
|
|
79
79
|
const url = `${getBaseUrl()}/${apiUrl}/${tableName}/${id}`;
|
|
80
|
-
const res = await api.get(url
|
|
81
|
-
params: {
|
|
82
|
-
id
|
|
83
|
-
}
|
|
84
|
-
});
|
|
80
|
+
const res = await api.get(url);
|
|
85
81
|
return res.data;
|
|
86
82
|
}
|
|
87
83
|
} catch (error) {
|
|
@@ -2,12 +2,17 @@ import { toast } from "react-toastify";
|
|
|
2
2
|
import { exportExcel } from "../../api";
|
|
3
3
|
import { Button } from "@mui/material";
|
|
4
4
|
import { Download } from "@mui/icons-material";
|
|
5
|
+
import { URL_APPLICATION ,URL_APPLICATION_API } from "@/constants";
|
|
5
6
|
|
|
6
7
|
const ExportExcelButton = ({ tableName, data, size = "small" }) => {
|
|
7
8
|
const handleExportExcel = async (tableName, data) => {
|
|
8
9
|
const _data = await exportExcel({ tableName, data });
|
|
9
10
|
if (_data.status) {
|
|
10
|
-
|
|
11
|
+
if(URL_APPLICATION_API){
|
|
12
|
+
window.open(URL_APPLICATION + _data.url, "_blank").focus();
|
|
13
|
+
}else{
|
|
14
|
+
window.open(_data.url, "_blank").focus();
|
|
15
|
+
}
|
|
11
16
|
} else {
|
|
12
17
|
toast.error("Xuất file thất bại!");
|
|
13
18
|
}
|