diff --git a/src/actions/index.js b/src/actions/index.js index f0fa858..af17cf4 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -66,7 +66,7 @@ export const newBlogPost = (payload) => async (dispatch) => { }; export const newComment = (payload, parent_id) => async (dispatch) => { - const response = await sudoscientist.post('/blog/comments' + parent_id, payload) + const response = await sudoscientist.post('/blog/comments/' + parent_id, payload) if (response.status === 201) { window.location.reload() } diff --git a/src/components/Comments.js b/src/components/Comments.js index 8410f6a..362f232 100644 --- a/src/components/Comments.js +++ b/src/components/Comments.js @@ -1,7 +1,6 @@ import React from 'react'; import ReactMde from "react-mde"; import ReactMarkdown from 'react-markdown'; -import { useSelector } from "react-redux"; import { connect } from 'react-redux'; import 'github-markdown-css' import "react-mde/lib/styles/css/react-mde-all.css" @@ -10,12 +9,11 @@ import { newComment } from '../actions'; const Comment = (props) => { const [content, setContent] = React.useState(""); const [selectedTab, setSelectedTab] = React.useState("write"); - const username = useSelector(state => state.auth.username); const submitComment = () => { const payload = { content: content } - props.newComment(username, payload) + props.newComment(payload, props.post.currentId) } return (