Skip to content

Commit

Permalink
Update roomSetMember actions to accept sendlist/getlist
Browse files Browse the repository at this point in the history
  • Loading branch information
GBS-Skile authored and y123ob committed Jun 19, 2019
1 parent fdf1c42 commit c32cdc3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
7 changes: 6 additions & 1 deletion frontend/src/components/pages/RoomPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ const RoomPage = props => {
const events = {
selectNode(evt) {
const nodeId = evt.nodes.find(() => true)
onClickMember(members.find(m => m.membername === nodeId))
const member = members.find(m => m.membername === nodeId)
onClickMember(
member,
graph.edges.filter(({from}) => from === nodeId),
graph.edges.filter(({to}) => to === nodeId),
)
}
}

Expand Down
4 changes: 3 additions & 1 deletion frontend/src/containers/RoomPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ const mapStateToProps = state => ({
const mapDispatchToProps = dispatch => ({
onGetRoom: (url) => dispatch(roomGetRequest(url)),
onLeave: () => dispatch(roomLeave()),
onClickMember: member => dispatch(roomSetMember(member)),
onClickMember: (member, sendlist, getlist) => {
dispatch(roomSetMember(member, sendlist, getlist))
},
onToggle: () => dispatch(roomToggleContents()),
})

Expand Down
7 changes: 7 additions & 0 deletions frontend/src/store/payment/reducer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
ROOM_LEAVE,
ROOM_SET_MEMBER,
} from 'store/actions'
import * as actions from './actions';

Expand Down Expand Up @@ -35,6 +36,12 @@ import * as actions from './actions';
return {
...initialState,
}
case ROOM_SET_MEMBER:
return {
...state,
sendlist: action.sendlist,
getlist: action.getlist,
}
default:
return state
}
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/store/room/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ export const roomLeave = () => ({ type: ROOM_LEAVE })

export const ROOM_SET_MEMBER = "ROOM_SET_MEMBER"

export const roomSetMember = member => ({
export const roomSetMember = (member, sendlist, getlist) => ({
type: ROOM_SET_MEMBER,
member,
sendlist,
getlist,
})


Expand Down

0 comments on commit c32cdc3

Please sign in to comment.