I would like to download a file that comes from the api in React.js Thank you very much in advance...
This is my code
-- Consult the api --
const[data, setData]= useState(null);
const downloadRelase = async (id) => {
try {
const result = await clientAxios.get(`/api/comunicados/download/${id}/0`);
setData(result.data)
} catch (error) {
console.log(error);
}
};
-- Response "data" --
-- JSX --
<div className="p-0 col-12 col-md-6 text-primary">
<a className="w-auto p-0 btn" href={} onClick={()=> downloadRelase(relase.id)}>
Descargar firmado
</a>
<span> | </span>
<a className="w-auto p-0 btn" href="#!">
Verificar firma
</a>
</div>