added new polarGrafic
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user