Add basic version of Comments component

This commit is contained in:
riggraz
2019-09-17 11:33:18 +02:00
parent d05202a2d7
commit b40ddfd543
17 changed files with 389 additions and 10 deletions

View File

@@ -0,0 +1,32 @@
import {
COMMENT_REQUEST_SUCCESS,
} from '../actions/requestComment';
import IComment from '../interfaces/IComment';
const initialState: IComment = {
id: 0,
body: '',
userFullName: '',
updatedAt: '',
};
const commentReducer = (
state = initialState,
action,
): IComment => {
switch (action.type) {
case COMMENT_REQUEST_SUCCESS:
return {
id: action.comment.id,
body: action.comment.body,
userFullName: action.comment.user_full_name,
updatedAt: action.comment.updated_at,
};
default:
return state;
}
}
export default commentReducer;