Add basic version of post show page

This commit is contained in:
riggraz
2019-09-12 15:51:45 +02:00
parent 5ca113b545
commit f599471af1
18 changed files with 330 additions and 11 deletions

View File

@@ -1,3 +1,13 @@
import {
POST_REQUEST_START,
POST_REQUEST_SUCCESS,
POST_REQUEST_FAILURE,
} from '../actions/requestPost';
import {
CHANGE_POST_STATUS_SUCCESS,
} from '../actions/changePostStatus';
import IPost from '../interfaces/IPost';
const initialState: IPost = {
@@ -15,7 +25,7 @@ const postReducer = (
action,
): IPost => {
switch (action.type) {
case 'CONVERT':
case POST_REQUEST_SUCCESS:
return {
id: action.post.id,
title: action.post.title,
@@ -26,6 +36,14 @@ const postReducer = (
createdAt: action.post.created_at,
};
case CHANGE_POST_STATUS_SUCCESS:
return {
...state,
postStatusId: action.newPostStatusId,
};
case POST_REQUEST_START:
case POST_REQUEST_FAILURE:
default:
return state;
}