mirror of
https://github.com/wassname/talk.git
synced 2026-09-09 11:38:08 +08:00
withQuery and withMutation support for notifyOnError (default: true)
This commit is contained in:
@@ -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
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user