fixed other actions to use data object
This commit is contained in:
parent
7f52c9be02
commit
ca4311450d
4 changed files with 31 additions and 30 deletions
|
@ -5,8 +5,10 @@ import * as actions from 'constants/channel_action_types';
|
||||||
export function updateLoggedInChannel (name, shortId, longId) {
|
export function updateLoggedInChannel (name, shortId, longId) {
|
||||||
return {
|
return {
|
||||||
type: actions.CHANNEL_UPDATE,
|
type: actions.CHANNEL_UPDATE,
|
||||||
name,
|
data: {
|
||||||
shortId,
|
name,
|
||||||
longId,
|
shortId,
|
||||||
|
longId,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as actions from 'constants/publish_action_types';
|
||||||
export function selectFile (file) {
|
export function selectFile (file) {
|
||||||
return {
|
return {
|
||||||
type: actions.FILE_SELECTED,
|
type: actions.FILE_SELECTED,
|
||||||
file: file,
|
data: file,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,15 +17,17 @@ export function clearFile () {
|
||||||
export function updateMetadata (name, value) {
|
export function updateMetadata (name, value) {
|
||||||
return {
|
return {
|
||||||
type: actions.METADATA_UPDATE,
|
type: actions.METADATA_UPDATE,
|
||||||
name,
|
data: {
|
||||||
value,
|
name,
|
||||||
|
value,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function updateClaim (value) {
|
export function updateClaim (value) {
|
||||||
return {
|
return {
|
||||||
type: actions.CLAIM_UPDATE,
|
type: actions.CLAIM_UPDATE,
|
||||||
value,
|
data: value,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,29 +41,33 @@ export function setPublishInChannel (channel) {
|
||||||
export function updatePublishStatus (status, message) {
|
export function updatePublishStatus (status, message) {
|
||||||
return {
|
return {
|
||||||
type: actions.PUBLISH_STATUS_UPDATE,
|
type: actions.PUBLISH_STATUS_UPDATE,
|
||||||
status,
|
data: {
|
||||||
message,
|
status,
|
||||||
|
message,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function updateError (name, value) {
|
export function updateError (name, value) {
|
||||||
return {
|
return {
|
||||||
type: actions.ERROR_UPDATE,
|
type: actions.ERROR_UPDATE,
|
||||||
name,
|
data: {
|
||||||
value,
|
name,
|
||||||
|
value,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function updateSelectedChannel (value) {
|
export function updateSelectedChannel (channelName) {
|
||||||
return {
|
return {
|
||||||
type: actions.SELECTED_CHANNEL_UPDATE,
|
type: actions.SELECTED_CHANNEL_UPDATE,
|
||||||
value,
|
data: channelName,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function toggleMetadataInputs (value) {
|
export function toggleMetadataInputs (showMetadataInputs) {
|
||||||
return {
|
return {
|
||||||
type: actions.TOGGLE_METADATA_INPUTS,
|
type: actions.TOGGLE_METADATA_INPUTS,
|
||||||
value,
|
data: showMetadataInputs,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,11 +16,7 @@ export default function (state = initialState, action) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case actions.CHANNEL_UPDATE:
|
case actions.CHANNEL_UPDATE:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
loggedInChannel: {
|
loggedInChannel: action.data,
|
||||||
name : action.name,
|
|
||||||
shortId: action.shortId,
|
|
||||||
longId : action.longId,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
|
|
|
@ -34,19 +34,19 @@ export default function (state = initialState, action) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case actions.FILE_SELECTED:
|
case actions.FILE_SELECTED:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
file: action.file,
|
file: action.data,
|
||||||
});
|
});
|
||||||
case actions.FILE_CLEAR:
|
case actions.FILE_CLEAR:
|
||||||
return initialState;
|
return initialState;
|
||||||
case actions.METADATA_UPDATE:
|
case actions.METADATA_UPDATE:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
metadata: Object.assign({}, state.metadata, {
|
metadata: Object.assign({}, state.metadata, {
|
||||||
[action.name]: action.value,
|
[action.data.name]: action.data.value,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
case actions.CLAIM_UPDATE:
|
case actions.CLAIM_UPDATE:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
claim: action.value,
|
claim: action.data,
|
||||||
});
|
});
|
||||||
case actions.SET_PUBLISH_IN_CHANNEL:
|
case actions.SET_PUBLISH_IN_CHANNEL:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
|
@ -54,24 +54,21 @@ export default function (state = initialState, action) {
|
||||||
});
|
});
|
||||||
case actions.PUBLISH_STATUS_UPDATE:
|
case actions.PUBLISH_STATUS_UPDATE:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
status: Object.assign({}, state.status, {
|
status: action.data,
|
||||||
status : action.status,
|
|
||||||
message: action.message,
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
case actions.ERROR_UPDATE:
|
case actions.ERROR_UPDATE:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
error: Object.assign({}, state.error, {
|
error: Object.assign({}, state.error, {
|
||||||
[action.name]: action.value,
|
[action.data.name]: action.data.value,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
case actions.SELECTED_CHANNEL_UPDATE:
|
case actions.SELECTED_CHANNEL_UPDATE:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
selectedChannel: action.value,
|
selectedChannel: action.data,
|
||||||
});
|
});
|
||||||
case actions.TOGGLE_METADATA_INPUTS:
|
case actions.TOGGLE_METADATA_INPUTS:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
showMetadataInputs: action.value,
|
showMetadataInputs: action.data,
|
||||||
});
|
});
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
|
|
Loading…
Reference in a new issue