mirror of
https://github.com/wassname/talk.git
synced 2026-07-15 11:26:58 +08:00
Notify on errors (embed stream - configure)
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
withUpdateAssetStatus,
|
||||
withCloseAsset,
|
||||
} from 'coral-framework/graphql/mutations';
|
||||
import { notifyOnMutationError } from 'coral-framework/hocs';
|
||||
|
||||
class AssetStatusInfoContainer extends React.Component {
|
||||
openAsset = () =>
|
||||
@@ -45,7 +46,8 @@ const withAssetStatusInfoFragments = withFragments({
|
||||
const enhance = compose(
|
||||
withAssetStatusInfoFragments,
|
||||
withUpdateAssetStatus,
|
||||
withCloseAsset
|
||||
withCloseAsset,
|
||||
notifyOnMutationError(['updateAssetStatus', 'closeAsset'])
|
||||
);
|
||||
|
||||
export default enhance(AssetStatusInfoContainer);
|
||||
|
||||
@@ -9,6 +9,10 @@ import { getDefinitionName } from 'coral-framework/utils';
|
||||
|
||||
class ConfigureContainer extends React.Component {
|
||||
render() {
|
||||
if (this.props.data.error) {
|
||||
return <div>{this.props.data.error.message}</div>;
|
||||
}
|
||||
|
||||
return (
|
||||
<Configure
|
||||
data={this.props.data}
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
import React from 'react';
|
||||
import { gql, compose } from 'react-apollo';
|
||||
import { withFragments, withMergedSettings } from 'coral-framework/hocs';
|
||||
import {
|
||||
getErrorMessages,
|
||||
getSlotFragmentSpreads,
|
||||
} from 'coral-framework/utils';
|
||||
import { getSlotFragmentSpreads } from 'coral-framework/utils';
|
||||
import Settings from '../components/Settings.js';
|
||||
import PropTypes from 'prop-types';
|
||||
import { withUpdateAssetSettings } from 'coral-framework/graphql/mutations';
|
||||
import { connect } from 'react-redux';
|
||||
import { bindActionCreators } from 'redux';
|
||||
import { notify } from 'coral-framework/actions/notification';
|
||||
import { clearPending, updatePending } from '../../../actions/configure';
|
||||
import { notifyOnMutationError } from 'coral-framework/hocs';
|
||||
|
||||
const slots = ['streamSettings'];
|
||||
|
||||
@@ -50,15 +47,11 @@ class SettingsContainer extends React.Component {
|
||||
};
|
||||
|
||||
savePending = async () => {
|
||||
try {
|
||||
await this.props.updateAssetSettings(
|
||||
this.props.asset.id,
|
||||
this.props.pending
|
||||
);
|
||||
this.props.clearPending();
|
||||
} catch (err) {
|
||||
this.props.notify('error', getErrorMessages(err));
|
||||
}
|
||||
await this.props.updateAssetSettings(
|
||||
this.props.asset.id,
|
||||
this.props.pending
|
||||
);
|
||||
this.props.clearPending();
|
||||
};
|
||||
|
||||
render() {
|
||||
@@ -98,7 +91,6 @@ SettingsContainer.propTypes = {
|
||||
mergedSettings: PropTypes.object.isRequired,
|
||||
updateAssetSettings: PropTypes.func.isRequired,
|
||||
clearPending: PropTypes.func.isRequired,
|
||||
notify: PropTypes.func.isRequired,
|
||||
updatePending: PropTypes.func.isRequired,
|
||||
canSave: PropTypes.bool.isRequired,
|
||||
};
|
||||
@@ -135,7 +127,6 @@ const mapStateToProps = state => ({
|
||||
const mapDispatchToProps = dispatch =>
|
||||
bindActionCreators(
|
||||
{
|
||||
notify,
|
||||
clearPending,
|
||||
updatePending,
|
||||
},
|
||||
@@ -145,6 +136,7 @@ const mapDispatchToProps = dispatch =>
|
||||
const enhance = compose(
|
||||
withSettingsFragments,
|
||||
withUpdateAssetSettings,
|
||||
notifyOnMutationError(['updateAssetSettings']),
|
||||
connect(mapStateToProps, mapDispatchToProps),
|
||||
withMergedSettings('asset.settings', 'pending', 'mergedSettings')
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user