Merge remote-tracking branch 'origin/staging' into origin/production

This commit is contained in:
Linksehat Staging Server
2024-02-02 14:55:43 +07:00

View File

@@ -175,6 +175,7 @@ export default function List() {
const createMenu = Boolean(anchorEl); const createMenu = Boolean(anchorEl);
const importForm = useRef<HTMLInputElement>(null); const importForm = useRef<HTMLInputElement>(null);
const [currentImportFileName, setCurrentImportFileName] = useState(null); const [currentImportFileName, setCurrentImportFileName] = useState(null);
const [importLoading, setImportLoading] = useState(false);
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => { const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
setAnchorEl(event.currentTarget); setAnchorEl(event.currentTarget);
@@ -201,15 +202,31 @@ export default function List() {
}; };
const handleGetData = (type :string) => { const handleGetData = (type :string) => {
axios.get(`report/logs/export`) const parameters =
.then((response) => { Object.keys(appliedParams).length !== 0
const link = document.createElement('a'); ? appliedParams
link.href = response.data.data.file_url; : Object.fromEntries([...searchParams.entries(), ['order', order], ['orderBy', orderBy]]);
link.setAttribute('download', response.data.data.file_name); setImportLoading(true);
document.body.appendChild(link); axios.get('/report/logs/export', {
link.click(); params: { ...parameters },
handleClose(); }).then((response) => {
}) const link = document.createElement('a');
link.href = response.data.data.file_url;
link.setAttribute('download', response.data.data.file_name);
document.body.appendChild(link);
link.click();
handleClose();
setImportLoading(false);
});
// axios.get(`report/logs/export`)
// .then((response) => {
// const link = document.createElement('a');
// link.href = response.data.data.file_url;
// link.setAttribute('download', response.data.data.file_name);
// document.body.appendChild(link);
// link.click();
// handleClose();
// })
} }
return ( return (