clear publish and edit pages based on publish.isUpdate

This commit is contained in:
Travis Eden 2018-09-26 12:00:42 -04:00
parent 5d3f66d201
commit 2778c42773
4 changed files with 17 additions and 20 deletions

View file

@ -9,6 +9,7 @@ const mapStateToProps = (props) => {
return {
asset : selectAsset(show),
myChannel: props.channel.loggedInChannel.name,
isUpdate : props.publish.isUpdate,
};
};

View file

@ -5,16 +5,16 @@ import PublishTool from '@containers/PublishTool';
class EditPage extends React.Component {
componentDidMount () {
const {asset, match, onHandleShowPageUri, setUpdateTrue, updateMetadata} = this.props;
onHandleShowPageUri(match.params);
setUpdateTrue();
if (asset) {
['title', 'description', 'license', 'nsfw'].forEach(meta => updateMetadata(meta, asset.claimData[meta]));
const {asset, isUpdate, match, onHandleShowPageUri, clearFile, setUpdateTrue, updateMetadata} = this.props;
if (!isUpdate) {
clearFile();
onHandleShowPageUri(match.params);
setUpdateTrue();
if (asset) {
['title', 'description', 'license', 'nsfw'].forEach(meta => updateMetadata(meta, asset.claimData[meta]));
}
}
}
componentWillUnmount () {
this.props.clearFile();
}
render () {
const { myChannel, asset } = this.props;
// redirect if user does not own this claim

View file

@ -2,6 +2,7 @@ import { connect } from 'react-redux';
import { onHandleShowHomepage } from '../../actions/show';
import View from './view';
<<<<<<< HEAD
const mapStateToProps = ({ show, site, channel }) => {
return {
error : show.request.error,
@ -9,6 +10,9 @@ const mapStateToProps = ({ show, site, channel }) => {
homeChannel: site.publishOnlyApproved && !channel.loggedInChannel.name ? `${site.approvedChannels[0].name}:${site.approvedChannels[0].longId}` : null,
};
};
=======
const mapStateToProps = props => ({ isUpdate: props.publish.isUpdate });
>>>>>>> clear publish and edit pages based on publish.isUpdate
const mapDispatchToProps = {
onHandleShowHomepage,

View file

@ -4,18 +4,10 @@ import PublishTool from '@containers/PublishTool';
import ContentPageWrapper from '@pages/ContentPageWrapper';
class HomePage extends React.Component {
// componentDidMount () {
// this.props.onHandleShowHomepage(this.props.match.params);
// }
//
// componentWillReceiveProps (nextProps) {
// if (nextProps.match.params !== this.props.match.params) {
// this.props.onHandleShowHomepage(nextProps.match.params);
// }
// }
componentWillUnmount () {
this.props.clearFile();
componentDidMount () {
if (this.props.isUpdate) {
this.props.clearFile();
}
}
render () {
const { homeChannel } = this.props;