27 lines
506 B
JavaScript
27 lines
506 B
JavaScript
import { FETCH_ISSUES_SUCCESS } from "../actions/issues";
|
|
|
|
const defaultState = {
|
|
byProject: {}
|
|
};
|
|
|
|
export function issuesReducer(state = defaultState, action) {
|
|
switch(action.type) {
|
|
case FETCH_ISSUES_SUCCESS:
|
|
return handleFetchIssuesSuccess(state, action);
|
|
default:
|
|
return state;
|
|
}
|
|
|
|
}
|
|
|
|
function handleFetchIssuesSuccess(state, action) {
|
|
return {
|
|
...state,
|
|
byProject: {
|
|
...state.byProject,
|
|
[action.project]: [
|
|
...action.issues,
|
|
]
|
|
}
|
|
}
|
|
} |