Skip to content
This repository was archived by the owner on Jul 7, 2021. It is now read-only.

Commit d27f25c

Browse files
committed
update the postReducer function to return fetched posts
1 parent b41f591 commit d27f25c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/reducers/postReducer.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { FETCH_POSTS, NEW_POST } from "../actions/types";
2+
import { act } from "react-dom/test-utils";
23

34
const initialState = {
45
items: [],
@@ -7,6 +8,11 @@ const initialState = {
78

89
export default function (state = initialState, action) {
910
switch (action.type) {
11+
case FETCH_POSTS:
12+
return {
13+
...state,
14+
items: action.payload,
15+
};
1016
default:
1117
return state;
1218
}

0 commit comments

Comments
 (0)