diff --git a/web/app/assets/javascripts/bandProfile.js b/web/app/assets/javascripts/bandProfile.js
index 7027661ea..0b5b3a28a 100644
--- a/web/app/assets/javascripts/bandProfile.js
+++ b/web/app/assets/javascripts/bandProfile.js
@@ -238,31 +238,34 @@
}
function bindSocial() {
- // FOLLOWERS
- var url = "/api/bands/" + bandId + "/followers";
- $.ajax({
- type: "GET",
- dataType: "json",
- url: url,
- async: false,
- processData:false,
- success: function(response) {
- $.each(response, function(index, val) {
- var template = $('#template-band-profile-social').html();
- var followerHtml = context.JK.fillTemplate(template, {
- userId: val.id,
- hoverAction: val.musician ? "musician" : "fan",
- avatar_url: context.JK.resolveAvatarUrl(val.photo_url),
- userName: val.name,
- location: val.location
- });
- $('#band-profile-social-followers').append(followerHtml);
- });
- },
- error: app.ajaxError
+ rest.getBandFollowers(bandId)
+ .done(function(response) {
+ $.each(response, function(index, val) {
+ var template = $('#template-band-profile-social').html();
+ var followerHtml = context.JK.fillTemplate(template, {
+ userId: val.id,
+ hoverAction: val.musician ? "musician" : "fan",
+ avatar_url: context.JK.resolveAvatarUrl(val.photo_url),
+ userName: val.name,
+ location: val.location
+ });
+
+ $('#band-profile-social-followers').append(followerHtml);
+
+ if (index === response.length-1) {
+ context.JK.bindHoverEvents();
+ }
+ })
+ })
+ .fail(function(xhr) {
+ if(xhr.status >= 500) {
+ context.JK.fetchUserNetworkOrServerFailure();
+ }
+ else {
+ context.JK.app.ajaxError(arguments);
+ }
});
- context.JK.bindHoverEvents();
}
/****************** HISTORY TAB *****************/
@@ -298,39 +301,38 @@
}
function bindMembers() {
- var url = "/api/bands/" + bandId + "/musicians";
- $.ajax({
- type: "GET",
- dataType: "json",
- url: url,
- async: false,
- processData:false,
- success: function(response) {
- bindMusicians(response);
- },
- error: app.ajaxError
- });
-
- if (isMember) {
+ rest.getBandMembers(bandId, false)
+ .done(function(response) {
+ bindMusicians(response);
+ if (isMember) {
bindPendingMembers();
- }
+ }
+ })
+ .fail(function(xhr) {
+ if(xhr.status >= 500) {
+ context.JK.fetchUserNetworkOrServerFailure();
+ }
+ else {
+ context.JK.app.ajaxError(arguments);
+ }
+ });
}
function bindPendingMembers() {
- var url = "/api/bands/" + bandId + "/musicians?pending=true";
- $.ajax({
- type: "GET",
- dataType: "json",
- url: url,
- async: false,
- processData:false,
- success: function(response) {
- if (response && response.length > 0) {
- $("#band-profile-members").append("