renamed previousRequests to requestList

This commit is contained in:
bill bittner 2018-02-14 12:19:43 -08:00
parent 0cecc84dde
commit 0548906c4d
11 changed files with 14 additions and 16 deletions

View file

@ -39,7 +39,7 @@ export function onNewAssetRequest (name, id, channelName, channelId, extension)
}; };
}; };
export function addRequestToPreviousRequests (id, error, key) { export function addRequestToRequestList (id, error, key) {
return { return {
type: actions.PREVIOUS_REQUEST_ADD, type: actions.PREVIOUS_REQUEST_ADD,
data: { id, error, key }, data: { id, error, key },

View file

@ -7,7 +7,7 @@ const mapStateToProps = ({ show }) => {
const error = show.displayAsset.error; const error = show.displayAsset.error;
const status = show.displayAsset.status; const status = show.displayAsset.status;
// select asset // select asset
const request = show.previousRequests[show.request.id]; const request = show.requestList[show.request.id];
const assetKey = request.key; const assetKey = request.key;
const asset = show.assetList[assetKey]; const asset = show.assetList[assetKey];
// return props // return props

View file

@ -3,7 +3,7 @@ import View from './view';
const mapStateToProps = ({ show }) => { const mapStateToProps = ({ show }) => {
// select asset // select asset
const request = show.previousRequests[show.request.id]; const request = show.requestList[show.request.id];
const assetKey = request.key; const assetKey = request.key;
const asset = show.assetList[assetKey]; const asset = show.assetList[assetKey];
// return props // return props

View file

@ -3,7 +3,7 @@ import View from './view';
const mapStateToProps = ({ show }) => { const mapStateToProps = ({ show }) => {
// select title // select title
const request = show.previousRequests[show.request.id]; const request = show.requestList[show.request.id];
const assetKey = request.key; const assetKey = request.key;
const asset = show.assetList[assetKey]; const asset = show.assetList[assetKey];
let title; let title;

View file

@ -2,12 +2,11 @@ import { connect } from 'react-redux';
import View from './view'; import View from './view';
const mapStateToProps = ({ show }) => { const mapStateToProps = ({ show }) => {
console.log('mapping state to props', show);
// select request info // select request info
const requestId = show.request.id; const requestId = show.request.id;
// select asset info // select asset info
let asset; let asset;
const request = show.previousRequests[requestId] || null; const request = show.requestList[requestId] || null;
const assetList = show.assetList; const assetList = show.assetList;
if (request && assetList) { if (request && assetList) {
const assetKey = request.key; // note: just store this in the request const assetKey = request.key; // note: just store this in the request

View file

@ -2,12 +2,11 @@ import { connect } from 'react-redux';
import View from './view'; import View from './view';
const mapStateToProps = ({ show }) => { const mapStateToProps = ({ show }) => {
console.log('mapping state to props', show);
// select request info // select request info
const requestId = show.request.id; const requestId = show.request.id;
// select asset info // select asset info
let asset; let asset;
const request = show.previousRequests[requestId] || null; const request = show.requestList[requestId] || null;
const assetList = show.assetList; const assetList = show.assetList;
if (request && assetList) { if (request && assetList) {
const assetKey = request.key; // note: just store this in the request const assetKey = request.key; // note: just store this in the request

View file

@ -5,7 +5,7 @@ const mapStateToProps = ({ show }) => {
// select request info // select request info
const requestId = show.request.id; const requestId = show.request.id;
// select request // select request
const previousRequest = show.previousRequests[requestId] || null; const previousRequest = show.requestList[requestId] || null;
// select channel // select channel
let channel; let channel;
if (previousRequest) { if (previousRequest) {

View file

@ -4,7 +4,7 @@ import View from './view';
const mapStateToProps = ({ show }) => { const mapStateToProps = ({ show }) => {
// select channel key // select channel key
const request = show.previousRequests[show.request.id]; const request = show.requestList[show.request.id];
const channelKey = request.key; const channelKey = request.key;
// select channel claims // select channel claims
const channel = show.channelList[channelKey] || null; const channel = show.channelList[channelKey] || null;

View file

@ -7,7 +7,7 @@ const initialState = {
type : null, type : null,
id : null, id : null,
}, },
previousRequests: {}, requestList: {},
channelList : {}, channelList : {},
assetList : {}, assetList : {},
displayAsset : { displayAsset : {
@ -36,7 +36,7 @@ export default function (state = initialState, action) {
// store requests // store requests
case actions.PREVIOUS_REQUEST_ADD: case actions.PREVIOUS_REQUEST_ADD:
return Object.assign({}, state, { return Object.assign({}, state, {
previousRequests: Object.assign({}, state.previousRequests, { requestList: Object.assign({}, state.requestList, {
[action.data.id]: { [action.data.id]: {
error: action.data.error, error: action.data.error,
key : action.data.key, key : action.data.key,

View file

@ -1,6 +1,6 @@
import { call, put, takeLatest } from 'redux-saga/effects'; import { call, put, takeLatest } from 'redux-saga/effects';
import * as actions from 'constants/show_action_types'; import * as actions from 'constants/show_action_types';
import { addRequestToPreviousRequests, onRequestError, addAssetToAssetList } from 'actions/show'; import { addRequestToRequestList, onRequestError, addAssetToAssetList } from 'actions/show';
import { getLongClaimId, getShortId, getClaimData } from 'api/assetApi'; import { getLongClaimId, getShortId, getClaimData } from 'api/assetApi';
function* newAssetRequest (action) { function* newAssetRequest (action) {
@ -16,7 +16,7 @@ function* newAssetRequest (action) {
} }
// put action to add request to asset request list // put action to add request to asset request list
const assetKey = `a#${name}#${longId}`; const assetKey = `a#${name}#${longId}`;
yield put(addRequestToPreviousRequests(requestId, null, assetKey)); yield put(addRequestToRequestList(requestId, null, assetKey));
// get short Id // get short Id
console.log(`getting asset short id ${name} ${longId}`); console.log(`getting asset short id ${name} ${longId}`);
let shortId; let shortId;

View file

@ -1,6 +1,6 @@
import { call, put, takeLatest } from 'redux-saga/effects'; import { call, put, takeLatest } from 'redux-saga/effects';
import * as actions from 'constants/show_action_types'; import * as actions from 'constants/show_action_types';
import { addNewChannelToChannelList, addRequestToPreviousRequests, onRequestError, updateChannelClaims } from 'actions/show'; import { addNewChannelToChannelList, addRequestToRequestList, onRequestError, updateChannelClaims } from 'actions/show';
import { getChannelClaims, getChannelData } from 'api/channelApi'; import { getChannelClaims, getChannelData } from 'api/channelApi';
function* getNewChannelAndUpdateChannelList (action) { function* getNewChannelAndUpdateChannelList (action) {
@ -15,7 +15,7 @@ function* getNewChannelAndUpdateChannelList (action) {
} }
// store the request in the channel requests list // store the request in the channel requests list
const channelKey = `c#${channelName}#${longId}`; const channelKey = `c#${channelName}#${longId}`;
yield put(addRequestToPreviousRequests(requestId, null, channelKey)); yield put(addRequestToRequestList(requestId, null, channelKey));
// get channel claims data // get channel claims data
console.log('getting channel claims data'); console.log('getting channel claims data');
let claimsData; let claimsData;