Fixed use of redux action

This commit is contained in:
Rodrigo Pedroso 2019-06-19 16:37:03 -04:00
commit b556441459
7 changed files with 94 additions and 8 deletions

View file

@ -1,5 +1,5 @@
import { ADD_ARTICLE } from "../constants/action-types"
export function addArticle(payload) {
return { type: "ADD_ARTICLE", payload }
return { type: ADD_ARTICLE, payload }
}

View file

@ -29,6 +29,7 @@ class ConnectedForm extends Component {
event.preventDefault()
const { title } = this.state
const id = uuidv1()
this.props.addArticle({ title, id })
this.setState({ title: "" })
}

View file

@ -1,6 +0,0 @@
import store from "../js/store/index"
import { addArticle } from "../js/actions/index"
window.store = store
window.addArticle = addArticle

View file

@ -1,4 +1,4 @@
import { ADD_ARTICLE } from "../constants/action-types"
import { ADD_ARTICLE } from '../constants/action-types'
const initialState = {
articles: []