fix(ui) - integration list refresh on add or remove

This commit is contained in:
Shekar Siri 2022-09-13 13:33:32 +05:30
parent 0f152ac830
commit 0bac6f65c5

View file

@ -2,7 +2,7 @@ import React from 'react';
import { connect } from 'react-redux';
import { Input, Form, Button, Checkbox, Loader } from 'UI';
import SiteDropdown from 'Shared/SiteDropdown';
import { save, init, edit, remove, fetchList } from 'Duck/integrations/actions';
import { save, init, edit, remove } from 'Duck/integrations/actions';
import { fetchIntegrationList } from 'Duck/integrations/integrations';
@connect(
@ -21,7 +21,7 @@ import { fetchIntegrationList } from 'Duck/integrations/integrations';
init,
edit,
remove,
fetchList,
// fetchList,
fetchIntegrationList,
}
)
@ -33,6 +33,16 @@ export default class IntegrationForm extends React.PureComponent {
// this.init(currentSiteId);
}
fetchList = () => {
alert('calling...');
const { siteId, initialSiteId } = this.props;
if (!siteId) {
this.props.fetchIntegrationList(initialSiteId);
} else {
this.props.fetchIntegrationList(siteId);
}
}
write = ({ target: { value, name: key, type, checked } }) => {
if (type === 'checkbox') this.props.edit(this.props.name, { [key]: checked });
else this.props.edit(this.props.name, { [key]: value });
@ -57,6 +67,7 @@ export default class IntegrationForm extends React.PureComponent {
// const { currentSiteId } = this.state;
this.props.save(customPath || name, !ignoreProject ? this.props.siteId : null, config).then(() => {
// this.props.fetchList(name);
this.fetchList();
this.props.onClose();
if (isExists) return;
});
@ -67,7 +78,7 @@ export default class IntegrationForm extends React.PureComponent {
this.props.remove(name, !ignoreProject ? config.projectId : null).then(
function () {
this.props.onClose();
this.props.fetchList(name);
this.fetchList();
}.bind(this)
);
};