added new polarGrafic

This commit is contained in:
2026-03-26 09:51:36 -05:00
parent 1de6761d03
commit dc75a7b1a7
10 changed files with 168 additions and 100 deletions
+9 -11
View File
@@ -10,33 +10,31 @@ interface Props {
count?: boolean;
}
export default function DownloadTable({ filtros,count }: Props) {
export default function DownloadTable({ filtros, count }: Props) {
const [loading, setLoading] = useState(false);
const handleDownload = async () => {
if(!filtros.length){return}
if (!filtros) { return }
setLoading(true);
const token = Cookies.get("token");
try {
const endpoint = count
? "/equipos/excel/tabla/count"
: "/equipos/excel/tabla";
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
const endpoint = count
? "/equipos/excel/tabla/count"
: "/equipos/excel/tabla";
const response = await axios.post(
`${process.env.NEXT_PUBLIC_API_URL}${endpoint}`,
filtros,
{
headers: {
Authorization: `Bearer ${token}`,
},
headers,
responseType: "blob",
}
);
const url = window.URL.createObjectURL(new Blob([response.data]));
console.log(url)
const a = document.createElement("a");
a.href = url;
a.download = "reporte.xlsx";