mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: api usage
This commit is contained in:
@@ -116,11 +116,14 @@ define('forum/account/header', [
|
|||||||
}
|
}
|
||||||
|
|
||||||
function toggleFollow(type) {
|
function toggleFollow(type) {
|
||||||
api[type === 'follow' ? 'put' : 'delete']('/users/' + ajaxify.data.uid + '/follow', undefined, () => {
|
api[type === 'follow' ? 'put' : 'delete']('/users/' + ajaxify.data.uid + '/follow', undefined, function (err) {
|
||||||
|
if (err) {
|
||||||
|
return app.alertError(err);
|
||||||
|
}
|
||||||
components.get('account/follow').toggleClass('hide', type === 'follow');
|
components.get('account/follow').toggleClass('hide', type === 'follow');
|
||||||
components.get('account/unfollow').toggleClass('hide', type === 'unfollow');
|
components.get('account/unfollow').toggleClass('hide', type === 'unfollow');
|
||||||
app.alertSuccess('[[global:alert.' + type + ', ' + ajaxify.data.username + ']]');
|
app.alertSuccess('[[global:alert.' + type + ', ' + ajaxify.data.username + ']]');
|
||||||
}, 'default');
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user