Started to create articles reducer and api
This commit is contained in:
parent
ca6585307b
commit
ac3c1b2060
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"articles": [
|
||||
{
|
||||
"title": "Test Article",
|
||||
"desc":"This is a description",
|
||||
"contents": "Hello World"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
let articleReducer = (state={articles=[]}, action) => {
|
||||
switch(action.type) {
|
||||
case "GET_ARTICLES":
|
||||
return { ...state, articles: action.payload };
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export default articleReducer;
|
||||
Loading…
Reference in New Issue