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 { return {
asset : selectAsset(show), asset : selectAsset(show),
myChannel: props.channel.loggedInChannel.name, myChannel: props.channel.loggedInChannel.name,
isUpdate : props.publish.isUpdate,
}; };
}; };

View file

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

View file

@ -2,6 +2,7 @@ import { connect } from 'react-redux';
import { onHandleShowHomepage } from '../../actions/show'; import { onHandleShowHomepage } from '../../actions/show';
import View from './view'; import View from './view';
<<<<<<< HEAD
const mapStateToProps = ({ show, site, channel }) => { const mapStateToProps = ({ show, site, channel }) => {
return { return {
error : show.request.error, 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, 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 = { const mapDispatchToProps = {
onHandleShowHomepage, onHandleShowHomepage,

View file

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