Skip to content

Commit

Permalink
Redudant Code For Posts
Browse files Browse the repository at this point in the history
  • Loading branch information
bsl782 committed Dec 6, 2019
1 parent b2ae0e5 commit ed6453d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion frontend/src/components/Posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class Posts extends Component {
handleCommentButton = e => {
this.props.createNewComment(
this.props.postData._id,
this.props.user._id,
this.state.content,
this.props.token
);
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/store/actions/commentActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {NEW_COMMENT_SUCCESS, NEW_COMMENT_FAIL} from './actionTypes';
import axios from 'axios';

//Create new comment
export const createNewComment = ( post, author, content, userToken) => dispatch => {
export const createNewComment = ( post, content, userToken) => dispatch => {

const config = {
headers: {
Expand All @@ -12,7 +12,7 @@ const config = {
};

//Request Body
let body = JSON.stringify({ post, author, content });
let body = JSON.stringify({ post, content });

axios.post('/comments/createComment', body, config)
.then(res => {
Expand All @@ -36,7 +36,8 @@ export const deleteComment = (commentId, userToken) => dispatch => {
Authorization: `Bearer ${userToken}`
}
};

console.log(commentId);
console.log(userToken);
axios.delete(`/comments/${commentId}`, config)
.then(res => {
})
Expand Down

0 comments on commit ed6453d

Please sign in to comment.