MCPcopy Index your code
hub / github.com/gitpoint/git-point / issueReducer

Function issueReducer

src/issue/issue.reducer.js:37–265  ·  view source on GitHub ↗
(state = initialState, action = {})

Source from the content-addressed store, hash-verified

35};
36
37export const issueReducer = (state = initialState, action = {}) => {
38 switch (action.type) {
39 case POST_ISSUE_COMMENT.PENDING:
40 return {
41 ...state,
42 isPostingComment: true,
43 };
44 case POST_ISSUE_COMMENT.SUCCESS:
45 return {
46 ...state,
47 comments: [...state.comments, action.payload],
48 isPostingComment: false,
49 };
50 case POST_ISSUE_COMMENT.ERROR:
51 return {
52 ...state,
53 error: action.payload,
54 isPostingComment: false,
55 };
56 case DELETE_ISSUE_COMMENT.PENDING:
57 return {
58 ...state,
59 isDeletingComment: true,
60 };
61 case DELETE_ISSUE_COMMENT.SUCCESS:
62 return {
63 ...state,
64 comments: state.comments.filter(
65 comment => comment.id !== action.payload
66 ),
67 isDeletingComment: false,
68 };
69 case DELETE_ISSUE_COMMENT.ERROR:
70 return {
71 ...state,
72 error: action.payload,
73 isDeletingComment: false,
74 };
75 case EDIT_ISSUE_COMMENT.PENDING:
76 return {
77 ...state,
78 isEditingComment: true,
79 };
80 case EDIT_ISSUE_COMMENT.SUCCESS:
81 return {
82 ...state,
83 comments: state.comments.map(
84 comment =>
85 comment.id === action.payload.id
86 ? {
87 ...comment,
88 body: action.payload.body,
89 body_html: action.payload.body_html,
90 }
91 : comment
92 ),
93 isEditingComment: false,
94 };

Callers 1

issue.reducer.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected