Skip to content
Snippets Groups Projects
Commit 85ac118e authored by Matt Kirby's avatar Matt Kirby
Browse files

post methods fix

parent 801e07b8
No related branches found
No related tags found
1 merge request!27ALL Requirements done!!
......@@ -56,7 +56,7 @@ CommentsRouter.delete(
* POST /new'
* Returns a string
*/
CommentsRouter.get(
CommentsRouter.post(
"/new",
async (req: CustomJWTRequest, res: Response): Promise<void> => {
const { token } = req;
......@@ -78,13 +78,12 @@ CommentsRouter.get(
* POST /like/:postId'
* Returns a string
*/
CommentsRouter.get(
"/like/:commentId",
CommentsRouter.post(
"/like",
async (req: CustomJWTRequest, res: Response): Promise<Response> => {
const { token } = req;
const uid = (token as TokenData).userId;
const { userId } = req.body;
const commentId = req.params.postId;
const { commentId, userId } = req.body;
if (uid !== userId) {
return res.status(400).json({ error: "unauthorised" });
......@@ -105,13 +104,12 @@ CommentsRouter.get(
* POST /unlike/:postId'
* Returns a string
*/
CommentsRouter.get(
"/unlike/:commentId",
CommentsRouter.post(
"/unlike",
async (req: CustomJWTRequest, res: Response): Promise<Response> => {
const { token } = req;
const uid = (token as TokenData).userId;
const { userId } = req.body;
const commentId = req.params.postId;
const { commentId, userId } = req.body;
if (uid !== userId) {
return res.status(400).json({ error: "unauthorised" });
......
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