Skip to content
Snippets Groups Projects
Commit 85c49b2e authored by Gwangbin's avatar Gwangbin
Browse files

Fix: changed comment methods

parent b035424b
No related branches found
No related tags found
No related merge requests found
......@@ -86,7 +86,7 @@ router.get("/:id", async (req, res) => {
res.send(JSON.stringify(articles));
});
router.post("/comment/:id", async (req, res) => {
router.post("/:id/comment", async (req, res) => {
if (!req.session.sessionid) {
console.log("No session");
}
......@@ -99,7 +99,7 @@ router.post("/comment/:id", async (req, res) => {
res.send(JSON.stringify(articles));
})
router.delete("/comment/:articleid/:commentid", async (req, res) => {
router.delete("/:articleid/comment/:commentid", async (req, res) => {
if (!req.session.sessionid) {
console.log("No session");
}
......@@ -107,7 +107,7 @@ router.delete("/comment/:articleid/:commentid", async (req, res) => {
res.send(JSON.stringify(articles));
});
router.put("/comment/like/:id", async (req, res) => {
router.put("/:id/comment/like", async (req, res) => {
if (!req.session.sessionid) {
console.log("No session");
}
......
......@@ -24,7 +24,7 @@ function Comments({data}) {
function DeleteComment(e) {
const data = {id: _id}
axios
.delete(`http://localhost:8080/article/comment/${params.id}/${_id}`, data,
.delete(`http://localhost:8080/article/${params.id}/comment/${_id}`, data,
{
headers: {"Content-Type": 'application/json'}
})
......
......@@ -44,7 +44,7 @@ function PostRead() {
}, []);
function SetLike(){
axios.put(`http://localhost:8080/article/comment/like/${params.id}`)
axios.put(`http://localhost:8080/article/${params.id}/comment/like`)
.then(res => {
alert("The comment is successfully uploaded");
return requestLoadArticleById(params.id)
......@@ -69,7 +69,7 @@ function PostRead() {
return
}
const data = {content: inputComment}
axios.post(`http://localhost:8080/article/comment/${params.id}`, data,
axios.post(`http://localhost:8080/article/${params.id}/comment`, data,
{
headers: {"Content-Type": 'application/json'}
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment