🐛 Loading for first file uploaded
This commit is contained in:
parent
d27bebecb3
commit
e493d7e3a3
@ -86,6 +86,7 @@ export default class DepositDocument extends React.Component<IProps, IState> {
|
||||
|
||||
this.addDocument = this.addDocument.bind(this);
|
||||
this.onFileChange = this.onFileChange.bind(this);
|
||||
this.addFile = this.addFile.bind(this);
|
||||
this.removeFile = this.removeFile.bind(this);
|
||||
this.onDragOver = this.onDragOver.bind(this);
|
||||
this.onDragDrop = this.onDragDrop.bind(this);
|
||||
@ -147,7 +148,6 @@ export default class DepositDocument extends React.Component<IProps, IState> {
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
{this.props.document.document_status !== EDocumentStatus.VALIDATED && this.state.files.length > 0 && (
|
||||
<div className={classes["documents-container"]}>
|
||||
{this.state.files.map((file) => {
|
||||
const fileObj = file.file;
|
||||
@ -184,7 +184,6 @@ export default class DepositDocument extends React.Component<IProps, IState> {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{this.props.document.document_status !== EDocumentStatus.VALIDATED && (
|
||||
<div className={classes["bottom-container"]}>
|
||||
<Button variant={EButtonVariant.LINE} className={classes["add-button"]} onClick={this.addDocument}>
|
||||
@ -343,7 +342,6 @@ export default class DepositDocument extends React.Component<IProps, IState> {
|
||||
alert("Ce fichier est trop volumineux");
|
||||
return false;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
loading: true,
|
||||
});
|
||||
@ -410,8 +408,13 @@ export default class DepositDocument extends React.Component<IProps, IState> {
|
||||
const file = files[0];
|
||||
|
||||
try {
|
||||
if (file) this.addFile(file);
|
||||
if (file) {
|
||||
await this.setState({ loading: true }, () => {
|
||||
this.addFile(file);
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
this.setState({ loading: false });
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user