use selectAsset in mapStateToProps

This commit is contained in:
Travis Eden 2018-09-24 14:15:33 -04:00
parent 3935715e29
commit e25715f2cc
3 changed files with 7 additions and 36 deletions

View file

@ -1,22 +1,13 @@
import { connect } from 'react-redux';
import { clearFile, startPublish, abandonClaim } from '../../actions/publish';
import { selectAsset } from '../../selectors/show';
import View from './view';
const mapStateToProps = ({ show, publish }) => {
// select request info
const requestId = show.request.id;
// select asset info
let asset;
const request = show.requestList[requestId] || null;
const assetList = show.assetList;
if (request && assetList) {
const assetKey = request.key; // note: just store this in the request
asset = assetList[assetKey] || null;
};
return {
file : publish.file,
isUpdate: publish.isUpdate,
asset,
asset : selectAsset(show),
};
};

View file

@ -1,22 +1,13 @@
import { connect } from 'react-redux';
import { setUpdateTrue, updateMetadata, clearFile } from '../../actions/publish';
import { onHandleShowPageUri } from '../../actions/show';
import { selectAsset } from '../../selectors/show';
import View from './view';
const mapStateToProps = (props) => {
const { show } = props;
// select request info
const requestId = show.request.id;
// select asset info
let asset;
const request = show.requestList[requestId] || null;
const assetList = show.assetList;
if (request && assetList) {
const assetKey = request.key; // note: just store this in the request
asset = assetList[assetKey] || null;
}
return {
asset,
asset : selectAsset(show),
myChannel: props.channel.loggedInChannel.name,
};
};

View file

@ -1,21 +1,10 @@
import { connect } from 'react-redux';
import { selectAsset } from '../../selectors/show';
import View from './view';
const mapStateToProps = (props) => {
const {show} = props;
// select request info
const requestId = show.request.id;
// select asset info
let asset;
const request = show.requestList[requestId] || null;
const assetList = show.assetList;
if (request && assetList) {
const assetKey = request.key; // note: just store this in the request
asset = assetList[assetKey] || null;
}
// return props
const mapStateToProps = ({ show }) => {
return {
asset,
asset: selectAsset(show),
};
};