mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 11:17:49 +01:00
Add basic version of post show page
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user