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,16 +5,16 @@ 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;
onHandleShowPageUri(match.params); if (!isUpdate) {
setUpdateTrue(); clearFile();
if (asset) { onHandleShowPageUri(match.params);
['title', 'description', 'license', 'nsfw'].forEach(meta => updateMetadata(meta, asset.claimData[meta])); setUpdateTrue();
if (asset) {
['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;
// redirect if user does not own this claim // 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 { 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,18 +4,10 @@ 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) {
// } this.props.clearFile();
// }
// componentWillReceiveProps (nextProps) {
// if (nextProps.match.params !== this.props.match.params) {
// this.props.onHandleShowHomepage(nextProps.match.params);
// }
// }
componentWillUnmount () {
this.props.clearFile();
} }
render () { render () {
const { homeChannel } = this.props; const { homeChannel } = this.props;