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

Commit 5b2d4f6

Browse files
committed
call createPost action in PostForm component
1 parent 7842955 commit 5b2d4f6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/components/PostForm.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import React, { Component } from "react";
2+
import PropTypes from "prop-types";
3+
import { connect } from "react-redux";
4+
import { createPost } from "../actions/postActions";
25

36
class PostForm extends Component {
47
constructor(props) {
@@ -18,12 +21,12 @@ class PostForm extends Component {
1821
onSubmit(e) {
1922
e.preventDefault();
2023

21-
const body = {
24+
const post = {
2225
title: this.state.title,
2326
body: this.state.body,
2427
};
2528

26-
// Call Action
29+
this.props.createPost(post);
2730
}
2831

2932
render() {

0 commit comments

Comments
 (0)