Allow issue creation via UI
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { FETCH_ISSUES_SUCCESS } from "../actions/issues";
|
||||
import { FETCH_ISSUES_SUCCESS, CREATE_ISSUE_SUCCESS } from "../actions/issues";
|
||||
|
||||
const defaultState = {
|
||||
byProject: {}
|
||||
@ -8,6 +8,8 @@ export function issuesReducer(state = defaultState, action) {
|
||||
switch(action.type) {
|
||||
case FETCH_ISSUES_SUCCESS:
|
||||
return handleFetchIssuesSuccess(state, action);
|
||||
case CREATE_ISSUE_SUCCESS:
|
||||
return handleCreateIssueSuccess(state, action);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
@ -24,4 +26,17 @@ function handleFetchIssuesSuccess(state, action) {
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleCreateIssueSuccess(state, action) {
|
||||
return {
|
||||
...state,
|
||||
byProject: {
|
||||
...state.byProject,
|
||||
[action.project]: [
|
||||
...state.byProject[action.project],
|
||||
action.issue
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user