reconstructing dispatch payload to seperate person object and person index; also only sending uuid,status,role as props
This commit is contained in:
parent
bbdd97911c
commit
c057c4a9cc
@ -60,9 +60,12 @@ const PersonRole = (props) => {
|
|||||||
const toggled = toggledID;
|
const toggled = toggledID;
|
||||||
const handleClick = () => handleRoleTooltip(person.uuid);
|
const handleClick = () => handleRoleTooltip(person.uuid);
|
||||||
const handleOptionSelect = (updatedMember) => handleRoleUpdate(updatedMember);
|
const handleOptionSelect = (updatedMember) => handleRoleUpdate(updatedMember);
|
||||||
const _person = {
|
|
||||||
...person,
|
// Only send relevent info as props
|
||||||
personIndex
|
const _person = {
|
||||||
|
uuid: person.uuid,
|
||||||
|
status: person.status,
|
||||||
|
role: person.role
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -76,6 +79,7 @@ const PersonRole = (props) => {
|
|||||||
handleSelect={handleOptionSelect}
|
handleSelect={handleOptionSelect}
|
||||||
options={membersRolesOptions}
|
options={membersRolesOptions}
|
||||||
person={_person}
|
person={_person}
|
||||||
|
personIndex={personIndex}
|
||||||
/>
|
/>
|
||||||
: null }
|
: null }
|
||||||
</StyledWrapper>
|
</StyledWrapper>
|
||||||
|
@ -16,15 +16,22 @@ const arrowPosition = {
|
|||||||
module.exports = ({
|
module.exports = ({
|
||||||
handleSelect,
|
handleSelect,
|
||||||
person = {},
|
person = {},
|
||||||
|
personIndex,
|
||||||
options = [],
|
options = [],
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
const _options = options.map( (option, i) => {
|
const _options = options.map( (option, i) => {
|
||||||
|
|
||||||
const _onClick = () => handleSelect({
|
const payload = {
|
||||||
...person,
|
person: {
|
||||||
role: option
|
uuid: person.uuid,
|
||||||
});
|
status: person.status,
|
||||||
|
role: option
|
||||||
|
},
|
||||||
|
personIndex
|
||||||
|
};
|
||||||
|
|
||||||
|
const _onClick = () => handleSelect(payload);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li
|
<li
|
||||||
@ -53,4 +60,5 @@ module.exports.propTypes = {
|
|||||||
handleSelect: React.PropTypes.func,
|
handleSelect: React.PropTypes.func,
|
||||||
options: React.PropTypes.array,
|
options: React.PropTypes.array,
|
||||||
person: React.PropTypes.object,
|
person: React.PropTypes.object,
|
||||||
|
personIndex: React.PropTypes.number,
|
||||||
};
|
};
|
@ -51,6 +51,7 @@ module.exports = handleActions({
|
|||||||
// TODO:
|
// TODO:
|
||||||
// Change "1" to org index. At the moment only updates
|
// Change "1" to org index. At the moment only updates
|
||||||
// "biz-tech"
|
// "biz-tech"
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
ui: {
|
ui: {
|
||||||
@ -64,7 +65,7 @@ module.exports = handleActions({
|
|||||||
members: [
|
members: [
|
||||||
...state.data[1].members.slice(0, action.payload.personIndex),
|
...state.data[1].members.slice(0, action.payload.personIndex),
|
||||||
{
|
{
|
||||||
...action.payload
|
...action.payload.person
|
||||||
},
|
},
|
||||||
...state.data[1].members.slice(action.payload.personIndex + 1)
|
...state.data[1].members.slice(action.payload.personIndex + 1)
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user