2019-12-01 22:12:13 +01:00
|
|
|
import { FETCH_ISSUES_SUCCESS } from "../actions/issues";
|
2019-11-28 14:12:48 +01:00
|
|
|
|
2019-12-01 22:12:13 +01:00
|
|
|
const defaultState = {
|
|
|
|
byProject: {}
|
|
|
|
};
|
2019-11-28 14:12:48 +01:00
|
|
|
|
2019-12-01 22:12:13 +01:00
|
|
|
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,
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
2019-11-28 14:12:48 +01:00
|
|
|
}
|