Skip to content

Node.js based forum software built for the modern web

fix: api usage

Barış Soner Uşaklıfeecd66506dd
diff --git a/public/src/client/account/header.js b/public/src/client/account/header.js
index a72422c596..a975025eb0 100644
--- a/public/src/client/account/header.js
+++ b/public/src/client/account/header.js
@@ -116,11 +116,14 @@ define('forum/account/header', [
}
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/unfollow').toggleClass('hide', type === 'unfollow');
app.alertSuccess('[[global:alert.' + type + ', ' + ajaxify.data.username + ']]');
- }, 'default');
+ });
return false;
}