fix(update$): Remove User.update$, refactor to use native loopback interfaces

This commit is contained in:
Bouncey
2018-11-12 16:58:34 +00:00
committed by mrugesh mohapatra
parent 97f7d53bee
commit 0f73fdbd9c
7 changed files with 554 additions and 575 deletions

View File

@ -120,12 +120,15 @@ function getUnlinkSocial(req, res, next) {
const updateData = { [social]: null };
return user.update$(updateData).subscribe(() => {
return user.updateAttributes(updateData, err => {
if (err) {
return next(err);
}
log(`${social} has been unlinked successfully`);
req.flash('info', `You've successfully unlinked your ${social}.`);
return res.redirect('/' + username);
}, next);
return res.redirectWithFlash(`${homeLocation}/${username}`);
});
});
});
}