add verified folder error handling

This commit is contained in:
OxSaitama 2023-11-08 10:19:23 +01:00
parent e1468fbd6d
commit 6df9cd7d07

View File

@ -40,6 +40,7 @@ type IState = {
refusedReason?: string; refusedReason?: string;
isShowRefusedReasonModalVisible: boolean; isShowRefusedReasonModalVisible: boolean;
showFailedUploaded: string | null; showFailedUploaded: string | null;
showFailedDocument: string | null;
isAddDocumentModalVisible: boolean; isAddDocumentModalVisible: boolean;
isLoading: boolean; isLoading: boolean;
}; };
@ -159,11 +160,20 @@ export default class DepositOtherDocument extends React.Component<IProps, IState
</div> </div>
</div> </div>
</Confirm> </Confirm>
{this.state.showFailedUploaded && ( {this.state.showFailedDocument && (
<Alert <Alert
onClose={this.onCloseAlertUpload} onClose={this.onCloseAlertUpload}
header={"Fichier non autorisé"} header={"L'ajout de Document n'est plus autorisé"}
isOpen={!!this.state.showFailedUploaded}> isOpen={!!this.state.showFailedDocument}>
<div className={classes["modal-content"]}>
<Typography typo={ITypo.P_16} className={classes["text"]}>
{this.state.showFailedDocument}
</Typography>
</div>
</Alert>
)}
{this.state.showFailedUploaded && (
<Alert onClose={this.onCloseAlertUpload} header={"Fichier non autorisé"} isOpen={!!this.state.showFailedUploaded}>
<div className={classes["modal-content"]}> <div className={classes["modal-content"]}>
<Typography typo={ITypo.P_16} className={classes["text"]}> <Typography typo={ITypo.P_16} className={classes["text"]}>
{this.state.showFailedUploaded} {this.state.showFailedUploaded}
@ -188,15 +198,20 @@ export default class DepositOtherDocument extends React.Component<IProps, IState
const filesArray = this.state.currentFiles; const filesArray = this.state.currentFiles;
if (!filesArray) return; if (!filesArray) return;
let documentCreated: Document = {} as Document;
const documentCreated = await Documents.getInstance().post({ try {
folder: { documentCreated = await Documents.getInstance().post({
uid: this.props.folder_uid, folder: {
}, uid: this.props.folder_uid,
depositor: { },
uid: this.props.customer_uid, depositor: {
}, uid: this.props.customer_uid,
}); },
});
} catch (e) {
this.setState({ showFailedDocument: "Le dossier est vérifié aucune modification n'est acceptée", isLoading: false });
return;
}
for (let i = 0; i < filesArray.length; i++) { for (let i = 0; i < filesArray.length; i++) {
const formData = new FormData(); const formData = new FormData();