FIX: double XHR request when loading more badges
This commit is contained in:
parent
418bc4a844
commit
7ab153dac3
|
@ -21,6 +21,11 @@ export default Ember.Controller.extend({
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
loadMore() {
|
loadMore() {
|
||||||
|
if (this.get('loadingMore')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.set('loadingMore', true);
|
||||||
|
|
||||||
const userBadges = this.get('userBadges');
|
const userBadges = this.get('userBadges');
|
||||||
|
|
||||||
UserBadge.findByBadgeId(this.get('model.id'), {
|
UserBadge.findByBadgeId(this.get('model.id'), {
|
||||||
|
@ -31,6 +36,8 @@ export default Ember.Controller.extend({
|
||||||
if (userBadges.length === 0){
|
if (userBadges.length === 0){
|
||||||
this.set('noMoreBadges', true);
|
this.set('noMoreBadges', true);
|
||||||
}
|
}
|
||||||
|
}).finally(()=>{
|
||||||
|
this.set('loadingMore', false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue