change(ui) - project update error message

This commit is contained in:
Shekar Siri 2023-02-21 18:56:45 +01:00 committed by Taha Yassine Kraiem
parent a44c91f86c
commit e25c8e2ac8

View file

@ -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(() => {