updated action names
This commit is contained in:
parent
55eb2dd85f
commit
22c794a289
4 changed files with 20 additions and 24 deletions
|
@ -3,7 +3,7 @@ import * as actions from 'constants/show_action_types';
|
|||
// basic request parsing
|
||||
export function updateRequestError (error) {
|
||||
return {
|
||||
type: actions.REQUEST_ERROR,
|
||||
type: actions.REQUEST_UPDATE_ERROR,
|
||||
data: error,
|
||||
};
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ export function updateRequestWithChannelRequest (name, id) {
|
|||
export function updateRequestWithAssetRequest (name, id, channelName, channelId, extension) {
|
||||
const requestId = `ar#${name}#${id}#${channelName}#${channelId}`;
|
||||
return {
|
||||
type: actions.REQUEST_UPDATE_CLAIM,
|
||||
type: actions.REQUEST_UPDATE_ASSET,
|
||||
data: {
|
||||
requestId,
|
||||
name,
|
||||
|
@ -35,7 +35,7 @@ export function updateRequestWithAssetRequest (name, id, channelName, channelId,
|
|||
};
|
||||
};
|
||||
|
||||
// request for an asset
|
||||
// asset actions
|
||||
|
||||
export function newAssetRequest (id, name, modifier) {
|
||||
return {
|
||||
|
@ -53,12 +53,12 @@ export function addRequestToAssetRequests (id, error, name, claimId) {
|
|||
|
||||
export function addAssetToAssetList (id, error, name, claimId, shortId, claimData) {
|
||||
return {
|
||||
type: actions.ASSET_NEW_SUCCESS,
|
||||
type: actions.ASSET_ADD,
|
||||
data: { id, error, name, claimId, shortId, claimData },
|
||||
};
|
||||
}
|
||||
|
||||
// request for a channel
|
||||
// channel actions
|
||||
|
||||
export function newChannelRequest (id, name, channelId) {
|
||||
return {
|
||||
|
@ -69,14 +69,14 @@ export function newChannelRequest (id, name, channelId) {
|
|||
|
||||
export function addRequestToChannelRequests (id, error, name, longId, shortId) {
|
||||
return {
|
||||
type: actions.CHANNEL_REQUEST_SUCCESS,
|
||||
type: actions.CHANNEL_REQUEST_ADD,
|
||||
data: { id, error, name, longId, shortId },
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export function addNewChannelToChannelList (id, name, shortId, longId, claimsData) {
|
||||
return {
|
||||
type: actions.CHANNEL_NEW_SUCCESS,
|
||||
type: actions.CHANNEL_ADD,
|
||||
data: { id, name, shortId, longId, claimsData },
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,21 +1,17 @@
|
|||
// request actions
|
||||
export const REQUEST_UPDATE_CHANNEL = 'REQUEST_UPDATE_CHANNEL';
|
||||
export const REQUEST_UPDATE_CLAIM = 'REQUEST_UPDATE_CLAIM';
|
||||
export const REQUEST_ERROR = 'REQUEST_ERROR';
|
||||
export const REQUEST_UPDATE_ASSET = 'REQUEST_UPDATE_ASSET';
|
||||
export const REQUEST_UPDATE_ERROR = 'REQUEST_UPDATE_ERROR';
|
||||
|
||||
// asset actions
|
||||
export const ASSET_REQUEST_NEW = 'ASSET_REQUEST_NEW';
|
||||
export const ASSET_REQUEST_SUCCESS = 'ASSET_REQUEST_SUCCESS';
|
||||
|
||||
export const ASSET_NEW_ASYNC = 'ASSET_NEW_ASYNC';
|
||||
export const ASSET_NEW_SUCCESS = `ASSET_NEW_SUCCESS`;
|
||||
export const ASSET_ADD = `ASSET_ADD`;
|
||||
|
||||
// channel actions
|
||||
export const CHANNEL_REQUEST_NEW = 'CHANNEL_REQUEST_NEW';
|
||||
export const CHANNEL_REQUEST_SUCCESS = 'CHANNEL_REQUEST_SUCCESS';
|
||||
|
||||
export const CHANNEL_NEW_ASYNC = 'CHANNEL_NEW_ASYNC';
|
||||
export const CHANNEL_NEW_SUCCESS = 'CHANNEL_NEW_SUCCESS';
|
||||
export const CHANNEL_REQUEST_ADD = 'CHANNEL_REQUEST_ADD';
|
||||
export const CHANNEL_ADD = 'CHANNEL_ADD';
|
||||
|
||||
export const CHANNEL_CLAIMS_UPDATE_ASYNC = 'CHANNEL_CLAIMS_UPDATE_ASYNC';
|
||||
export const CHANNEL_CLAIMS_UPDATE_SUCCESS = 'CHANNEL_CLAIMS_UPDATE_SUCCESS';
|
||||
|
|
|
@ -22,7 +22,7 @@ const initialState = {
|
|||
export default function (state = initialState, action) {
|
||||
switch (action.type) {
|
||||
// handle request
|
||||
case actions.REQUEST_ERROR:
|
||||
case actions.REQUEST_UPDATE_ERROR:
|
||||
return Object.assign({}, state, {
|
||||
request: Object.assign({}, state.request, {
|
||||
error: action.data,
|
||||
|
@ -40,7 +40,7 @@ export default function (state = initialState, action) {
|
|||
},
|
||||
},
|
||||
});
|
||||
case actions.REQUEST_UPDATE_CLAIM:
|
||||
case actions.REQUEST_UPDATE_ASSET:
|
||||
return Object.assign({}, state, {
|
||||
request: {
|
||||
type : ASSET,
|
||||
|
@ -64,7 +64,7 @@ export default function (state = initialState, action) {
|
|||
},
|
||||
}),
|
||||
});
|
||||
case actions.ASSET_NEW_SUCCESS:
|
||||
case actions.ASSET_ADD:
|
||||
return Object.assign({}, state, {
|
||||
assetList: Object.assign({}, state.assetList, {
|
||||
[action.data.id]: {
|
||||
|
@ -77,7 +77,7 @@ export default function (state = initialState, action) {
|
|||
}),
|
||||
});
|
||||
// channel actions
|
||||
case actions.CHANNEL_REQUEST_SUCCESS:
|
||||
case actions.CHANNEL_REQUEST_ADD:
|
||||
return Object.assign({}, state, {
|
||||
channelRequests: Object.assign({}, state.channelRequests, {
|
||||
[action.data.id]: {
|
||||
|
@ -88,7 +88,7 @@ export default function (state = initialState, action) {
|
|||
},
|
||||
}),
|
||||
});
|
||||
case actions.CHANNEL_NEW_SUCCESS:
|
||||
case actions.CHANNEL_ADD:
|
||||
return Object.assign({}, state, {
|
||||
channelList: Object.assign({}, state.channelList, {
|
||||
[action.data.id]: {
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as actions from 'constants/show_action_types';
|
|||
import { addNewChannelToChannelList, addRequestToChannelRequests, updateRequestError, updateChannelClaims } from 'actions/show';
|
||||
import { getChannelClaims, getChannelData } from 'api/channelApi';
|
||||
|
||||
function* newChannelRequest (action) {
|
||||
function* getNewChannelAndUpdateChannelList (action) {
|
||||
const { id, name, channelId } = action.data;
|
||||
// get channel long id
|
||||
console.log('getting channel long id and short id');
|
||||
|
@ -31,7 +31,7 @@ function* newChannelRequest (action) {
|
|||
}
|
||||
|
||||
export function* watchNewChannelRequest () {
|
||||
yield takeLatest(actions.CHANNEL_REQUEST_NEW, newChannelRequest);
|
||||
yield takeLatest(actions.CHANNEL_REQUEST_NEW, getNewChannelAndUpdateChannelList);
|
||||
};
|
||||
|
||||
function* getNewClaimsAndUpdateChannel (action) {
|
||||
|
|
Loading…
Reference in a new issue