🐛 Carousel between files and not documents + download when validated

This commit is contained in:
Maxime Lalo 2023-04-26 12:09:00 +02:00
parent e2ede3a5be
commit cd93d5c340

View File

@ -59,8 +59,6 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
this.hasPrevious = this.hasPrevious.bind(this);
this.hasNext = this.hasNext.bind(this);
this.downloadFile = this.downloadFile.bind(this);
}
public override render(): JSX.Element | null {
@ -106,9 +104,9 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
</>
)}
{this.props.selectedDocument?.document_status === "VALIDATED" && (
<>
<Button onClick={this.downloadFile}>Télécharger</Button>
</>
<a href={this.state.selectedFile.file_path!} download>
<Button>Télécharger</Button>
</a>
)}
</div>
<Confirm
@ -177,17 +175,6 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
});
}
private downloadFile() {
var link = document.createElement("a");
// If you don't know the name or want to use
// the webserver default set name = ''
link.setAttribute("download", "super_nom.pdf");
link.href = "/";
document.body.appendChild(link);
link.click();
link.remove();
}
private goToPrevious() {
const index = this.state.selectedFileIndex - 1;
if (this.hasPrevious()) {