use route params for follows delete

This commit is contained in:
Daniel Lugo 2020-05-30 19:29:54 -04:00
parent 424f199b4e
commit 11c5337e0f

View file

@ -1916,10 +1916,13 @@ module.exports = async (
* @param {{ body: UnfollowRequest }} req
* @param {Response} res
*/
const apiGunFollowsDelete = (req, res) => {
const apiGunFollowsDelete = (req, res) => {
try {
const user = require('../services/gunDB/Mediator').getUser()
const { body: { publicKey }} = req
/**
* @type {string}
*/
const publicKey = req.params.publickey
user.get(Key.FOLLOWS).get(publicKey).put(null)
@ -1933,7 +1936,7 @@ module.exports = async (
ap.get('api/gun/follows', apiGunFollowsGet)
ap.post(`/api/gun/follows`, apiGunFollowsPost)
ap.delete(`api/gun/follows`, apiGunFollowsDelete)
ap.delete(`api/gun/follows/:publickey`, apiGunFollowsDelete)
/**
* Return app so that it can be used by express.