From bc24aaf26fca03c57b3138415eea8fc44bbc1aa8 Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Sat, 22 Jul 2017 23:36:36 +0200 Subject: [PATCH] Fix promotion request list update --- .../promotion/req-promotion.component.ts | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/static/src/app/request/promotion/req-promotion.component.ts b/static/src/app/request/promotion/req-promotion.component.ts index 528a1aa..e2dec44 100644 --- a/static/src/app/request/promotion/req-promotion.component.ts +++ b/static/src/app/request/promotion/req-promotion.component.ts @@ -61,22 +61,21 @@ export class RequestPromotionComponent { const promotion = { "userId": this.user._id, "oldRankLvl": this.user.rank.level, - "newRankLvl": this.newLevel, + "newRankLvl": this.newLevel }; - this.promotionService.requestPromotion(promotion).subscribe(); - this.showSuccessLabel = true; - setTimeout(() => { - this.showSuccessLabel = false; - }, 2000); - this.showForm = false; - this.user = {}; - - let currentUser = JSON.parse(localStorage.getItem('currentUser')); - this.promotionService.getSquadPromotions(currentUser.squad._id).subscribe(promotions => { - this.uncheckedPromotions = promotions; - }) - + this.promotionService.requestPromotion(promotion).subscribe(() => { + this.showSuccessLabel = true; + setTimeout(() => { + this.showSuccessLabel = false; + }, 2000); + this.showForm = false; + this.user = {}; + let currentUser = JSON.parse(localStorage.getItem('currentUser')); + this.promotionService.getSquadPromotions(currentUser.squad._id).subscribe(promotions => { + this.uncheckedPromotions = promotions; + }) + }); } cancel() {