From e25c8e2ac8d73fe82c39e295bb31b0ea95b2e864 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Tue, 21 Feb 2023 18:56:45 +0100 Subject: [PATCH] change(ui) - project update error message --- frontend/app/components/Client/Sites/NewSiteForm.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/app/components/Client/Sites/NewSiteForm.js b/frontend/app/components/Client/Sites/NewSiteForm.js index 2ff8ed917..6ce0f7d4c 100644 --- a/frontend/app/components/Client/Sites/NewSiteForm.js +++ b/frontend/app/components/Client/Sites/NewSiteForm.js @@ -10,6 +10,7 @@ import { confirm } from 'UI'; import { clearSearch } from 'Duck/search'; import { clearSearch as clearSearchLive } from 'Duck/liveSearch'; import { withStore } from 'App/mstore'; +import { toast } from 'react-toastify'; @connect( (state) => ({ @@ -61,9 +62,14 @@ export default class NewSiteForm extends React.PureComponent { return this.setState({ existsError: true }); } if (site.exists()) { - this.props.update(this.props.site, this.props.site.id).then(() => { - this.props.onClose(null); - this.props.fetchList(); + this.props.update(this.props.site, this.props.site.id).then((response) => { + if (!response || !response.errors || response.errors.size === 0) { + this.props.onClose(null); + this.props.fetchList(); + toast.success('Project updated successfully'); + } else { + toast.error(response.errors[0]); + } }); } else { this.props.save(this.props.site).then(() => {