Fixed use of redux action
This commit is contained in:
parent
8c3335094a
commit
b556441459
7 changed files with 94 additions and 8 deletions
|
@ -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 }
|
||||
}
|
||||
|
|
|
@ -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: "" })
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import store from "../js/store/index"
|
||||
import { addArticle } from "../js/actions/index"
|
||||
|
||||
window.store = store
|
||||
|
||||
window.addArticle = addArticle
|
|
@ -1,4 +1,4 @@
|
|||
import { ADD_ARTICLE } from "../constants/action-types"
|
||||
import { ADD_ARTICLE } from '../constants/action-types'
|
||||
|
||||
const initialState = {
|
||||
articles: []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue