Base générale d'UI
This commit is contained in:
@ -1,5 +1,27 @@
|
||||
import { FETCH_ISSUES_SUCCESS } from "../actions/issues";
|
||||
|
||||
export function issuesReducer(state = {}, action) {
|
||||
const defaultState = {
|
||||
byProject: {}
|
||||
};
|
||||
|
||||
return state;
|
||||
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,
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user