|
|
@@ -40,6 +40,19 @@ const MyDocument = (props) => {
|
|
|
setNumPages(numPages);
|
|
|
}
|
|
|
|
|
|
+ const Download = () => {
|
|
|
+ let url = `/report/cleaverResult/${props.id}?output=pdf`
|
|
|
+ let rest = new Service(url);
|
|
|
+
|
|
|
+ rest
|
|
|
+ .getBlob(props.token)
|
|
|
+ .then(blob => {
|
|
|
+ var file = window.URL.createObjectURL(blob.data);
|
|
|
+ window.location.assign(file);
|
|
|
+ })
|
|
|
+ .catch(error => console.log({ error }))
|
|
|
+ }
|
|
|
+
|
|
|
const [progress, setProgress] = useState(10);
|
|
|
|
|
|
if(!pdf){
|
|
|
@@ -85,7 +98,7 @@ const MyDocument = (props) => {
|
|
|
<Button
|
|
|
className="btnmain"
|
|
|
variant="contained"
|
|
|
- onClick={() => console.log('download')} >
|
|
|
+ onClick={Download} >
|
|
|
<DownloadIcon/>
|
|
|
</Button>
|
|
|
</div>
|
|
|
@@ -139,7 +152,7 @@ export function Resultados() {
|
|
|
<Paper
|
|
|
elevation={2}
|
|
|
sx={{ mb: 2, padding: 2, height: '100%', minHeight: '95vh', boxShadow: 'none !important' }}>
|
|
|
- <MyDocument pdf={pdf} />
|
|
|
+ <MyDocument token={auth.token} id={id} pdf={pdf} />
|
|
|
</Paper>
|
|
|
</Box>
|
|
|
</div>
|