test code
This commit is contained in:
parent
e402ea3a94
commit
6ba6d70a5f
1 changed files with 18 additions and 3 deletions
|
|
@ -1891,7 +1891,7 @@ module.exports = async (
|
|||
* @param {{ body: FollowRequest }} req
|
||||
* @param {Response} res
|
||||
*/
|
||||
const apiGunFollowsPost = (req, res) => {
|
||||
const apiGunFollowsPost = async (req, res) => {
|
||||
try {
|
||||
const user = require('../services/gunDB/Mediator').getUser()
|
||||
const { body: { publicKey }} = req
|
||||
|
|
@ -1903,9 +1903,24 @@ module.exports = async (
|
|||
user: publicKey
|
||||
}
|
||||
|
||||
user.get(Key.FOLLOWS).get(publicKey).put(newFollow)
|
||||
console.log('NEWFOLLOW WILL POST ' + publicKey)
|
||||
|
||||
return res.status(200)
|
||||
await new Promise((res, rej) => {
|
||||
user.get(Key.FOLLOWS).get(publicKey).put(newFollow, ack => {
|
||||
if (ack.err) {
|
||||
rej(new Error(ack.err))
|
||||
} else {
|
||||
res()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
console.log('NEWFOLLOW POSTED')
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(1)
|
||||
|
||||
return res.status(200).send()
|
||||
} catch (err) {
|
||||
return res.status(500).json({
|
||||
errorMessage: err.message || 'Unknown error inside /api/gun/follow'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue