withQuery and withMutation support for notifyOnError (default: true)

This commit is contained in:
Chi Vinh Le
2018-01-23 19:05:08 +01:00
parent 303e2e84c5
commit 0523faee2b
16 changed files with 133 additions and 139 deletions
@@ -7,7 +7,9 @@ import {
withUpdateAssetStatus,
withCloseAsset,
} from 'coral-framework/graphql/mutations';
import { notifyOnMutationError } from 'coral-framework/hocs';
import { notify } from 'coral-framework/actions/notification';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
class AssetStatusInfoContainer extends React.Component {
openAsset = () =>
@@ -43,11 +45,19 @@ const withAssetStatusInfoFragments = withFragments({
`,
});
const mapDispatchToProps = dispatch =>
bindActionCreators(
{
notify,
},
dispatch
);
const enhance = compose(
connect(null, mapDispatchToProps),
withAssetStatusInfoFragments,
withUpdateAssetStatus,
withCloseAsset,
notifyOnMutationError(['updateAssetStatus', 'closeAsset'])
withCloseAsset
);
export default enhance(AssetStatusInfoContainer);
@@ -8,7 +8,7 @@ import { withUpdateAssetSettings } from 'coral-framework/graphql/mutations';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { clearPending, updatePending } from '../../../actions/configure';
import { notifyOnMutationError } from 'coral-framework/hocs';
import { notify } from 'coral-framework/actions/notification';
const slots = ['streamSettings'];
@@ -129,15 +129,15 @@ const mapDispatchToProps = dispatch =>
{
clearPending,
updatePending,
notify,
},
dispatch
);
const enhance = compose(
connect(mapStateToProps, mapDispatchToProps),
withSettingsFragments,
withUpdateAssetSettings,
notifyOnMutationError(['updateAssetSettings']),
connect(mapStateToProps, mapDispatchToProps),
withMergedSettings('asset.settings', 'pending', 'mergedSettings')
);
@@ -1,5 +1,18 @@
import { compose } from 'react-apollo';
import { withChangeUsername } from 'coral-framework/graphql/mutations';
import ChangeUsername from '../components/ChangeUsername';
import { notify } from 'coral-framework/actions/notification';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
export default compose(withChangeUsername)(ChangeUsername);
const mapDispatchToProps = dispatch =>
bindActionCreators(
{
notify,
},
dispatch
);
export default compose(connect(null, mapDispatchToProps), withChangeUsername)(
ChangeUsername
);