From 4f65ab9692817565f3e911fa514f9e071831dc13 Mon Sep 17 00:00:00 2001 From: olewandowski1 Date: Mon, 25 Mar 2024 15:17:04 +0100 Subject: [PATCH] OP-1486: fix dialog when export fails --- src/components/BillSearcher.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/BillSearcher.js b/src/components/BillSearcher.js index 6b1ad52..3a973c3 100644 --- a/src/components/BillSearcher.js +++ b/src/components/BillSearcher.js @@ -3,7 +3,7 @@ import { bindActionCreators } from "redux"; import { connect } from "react-redux"; import { injectIntl } from "react-intl"; -import { IconButton, Tooltip, Button, Dialog, DialogActions, DialogTitle } from "@material-ui/core"; +import { IconButton, Tooltip, Button, Dialog, DialogActions, DialogTitle, DialogContent } from "@material-ui/core"; import EditIcon from "@material-ui/icons/Edit"; import DeleteIcon from "@material-ui/icons/Delete"; @@ -72,13 +72,17 @@ const BillSearcher = ({ }, [confirmed]); useEffect(() => { - setFailedExport(true); + if (errorBillsExport) { + setFailedExport(true); + } }, [errorBillsExport]); useEffect(() => { if (billsExport) { downloadExport(billsExport, "bill_export.csv")(); } + + return setFailedExport(false); }, [billsExport]); useEffect(() => { @@ -250,12 +254,15 @@ const BillSearcher = ({ "status": "Status", }} /> - {failedExport && ( - - {errorBillsExport} + + {errorBillsExport?.message} + + {`${errorBillsExport?.code}: `} + {errorBillsExport?.detail} + -