mirror of
https://github.com/wassname/talk.git
synced 2026-07-01 08:54:37 +08:00
Resolving 500 error when deleting an action.
This commit is contained in:
@@ -248,7 +248,8 @@ export function deleteAction (item_id, action_type, user_id, item_type) {
|
||||
return () => {
|
||||
const action = {
|
||||
action_type,
|
||||
user_id
|
||||
user_id,
|
||||
item_id
|
||||
};
|
||||
|
||||
return fetch(`/api/v1/${item_type}/${item_id}/actions`, getInit('DELETE', action))
|
||||
|
||||
+4
-4
@@ -194,12 +194,12 @@ CommentSchema.statics.removeById = function(id) {
|
||||
* @param {String} action_type the type of the action to be removed
|
||||
* @param {String} user_id the id of the user performing the action
|
||||
*/
|
||||
CommentSchema.statics.removeAction = function(id, user_id, action_type) {
|
||||
CommentSchema.statics.removeAction = function(item_id, user_id, action_type) {
|
||||
return Action.remove({
|
||||
action_type: action_type,
|
||||
action_type,
|
||||
item_type: 'comment',
|
||||
item_id: id,
|
||||
user_id: user_id
|
||||
item_id,
|
||||
user_id
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -135,9 +135,9 @@ router.delete('/:comment_id', (req, res, next) => {
|
||||
|
||||
router.delete('/:comment_id/actions', (req, res, next) => {
|
||||
Comment
|
||||
.removeAction(req.params.comment_id, req.body.user_id, req.body.action_type)
|
||||
.removeAction(req.params.item_id, req.body.user_id, req.body.action_type)
|
||||
.then(() => {
|
||||
res.status(201).sent({});
|
||||
res.status(201).send({});
|
||||
})
|
||||
.catch(error => {
|
||||
next(error);
|
||||
|
||||
Reference in New Issue
Block a user