mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
FIX: double XHR request when loading more badges
This commit is contained in:
parent
418bc4a844
commit
7ab153dac3
1 changed files with 7 additions and 0 deletions
|
@ -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 a new issue