Started to create articles reducer and api

This commit is contained in:
Camerin Figueroa 2021-10-25 17:44:28 -04:00
parent ca6585307b
commit ac3c1b2060
2 changed files with 21 additions and 0 deletions

9
public/articles.json Normal file
View File

@ -0,0 +1,9 @@
{
"articles": [
{
"title": "Test Article",
"desc":"This is a description",
"contents": "Hello World"
}
]
}

View File

@ -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;