From 9ab1071c8d90d112f1031cf006ed621011553e84 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 23 Aug 2016 14:48:59 +0200 Subject: [PATCH] Do not wait the make friends process ends to send a response to the request --- .../app/admin/friends/friend-add/friend-add.component.ts | 3 ++- server/controllers/api/v1/pods.js | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client/src/app/admin/friends/friend-add/friend-add.component.ts b/client/src/app/admin/friends/friend-add/friend-add.component.ts index 07888a781..ffc499b92 100644 --- a/client/src/app/admin/friends/friend-add/friend-add.component.ts +++ b/client/src/app/admin/friends/friend-add/friend-add.component.ts @@ -61,7 +61,8 @@ export class FriendAddComponent { if (status === 409) { alert('Already made friends!'); } else { - alert('Made friends!'); + alert('Make friends request sent!'); + this.router.navigate([ '/admin/friends/list' ]); } }, error => alert(error) diff --git a/server/controllers/api/v1/pods.js b/server/controllers/api/v1/pods.js index 982a1e364..360575a0d 100644 --- a/server/controllers/api/v1/pods.js +++ b/server/controllers/api/v1/pods.js @@ -86,10 +86,15 @@ function makeFriends (req, res, next) { const urls = req.body.urls friends.makeFriends(urls, function (err) { - if (err) return next(err) + if (err) { + logger.error('Could not make friends.', { error: err }) + return + } - res.type('json').status(204).end() + logger.info('Made friends!') }) + + res.type('json').status(204).end() } function removePods (req, res, next) {