gittoken-socket
Version:
GitToken Socket Server and Client Libraries
31 lines (27 loc) • 700 B
JavaScript
const INITIAL_STATE = {
organizations: {}
}
export default function reducer(state=INITIAL_STATE, action) {
switch(action.type) {
case 'WATCH_TOKEN':
state['organizations'][action.org] =
!state['organizations'][action.org] ? {} :
state['organizations'][action.org]
return {
...state,
organizations: {
...state['organizations'],
[]: {
...state['organizations'][action.org],
[]: {
...state['organizations'][action.org][action.event],
[]: action.data
}
}
}
}
break;
default:
return state
}
}