fix: api usage

v1.18.x
Barış Soner Uşaklı 4 years ago
parent a15ef53c70
commit feecd66506

@ -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;
} }

Loading…
Cancel
Save