Projekt

Obecné

Profil

« Předchozí | Další » 

Revize aab2b127

Přidáno uživatelem Václav Jirák před téměř 6 roky(ů)

Profile reload on add/remove vacation + removed uncecessary API calls when employee is logged in

Zobrazit rozdíly:

webapp/src/app/dashboard/employer-dashboard/employer-dashboard.component.ts
36 36
  ngOnInit() {
37 37
    this.selectedMonth = this.dateToolsService.toStartOfMonth(new Date());
38 38

  
39
    this.loadProfile();
40
    this.loadAuthorizationRequests();
41
    this.loadVacationRequests();
39
    this.userService.getLoggedUserProfile()
40
      .subscribe((data: UserProfile) => {
41
        this.profile = data;
42
        if (this.isEmployer()) {
43
          this.loadAuthorizationRequests();
44
          this.loadVacationRequests();
45
        }
46
      });
47

  
42 48
    this.loadMonthVacation(this.selectedMonth);
43 49
    this.loadOncomingVacation();
44 50
  }
......
67 73
      .subscribe(() => {
68 74
        this.loadOncomingVacation();
69 75
        this.loadMonthVacation(this.selectedMonth);
76
        this.loadProfile();
70 77
      });
71 78
  }
72 79

  
......
90 97
          ).subscribe(() => {
91 98
            this.loadMonthVacation(this.selectedMonth);
92 99
            this.loadOncomingVacation();
100
            this.loadProfile();
93 101
          });
94 102
        }
95 103
      });
......
107 115
      return false;
108 116
    }
109 117
  }
118

  
110 119
  private loadProfile() {
111 120
    this.userService.getLoggedUserProfile()
112 121
      .subscribe((data: UserProfile) => this.profile = data);
webapp/src/app/services/api/user.service.ts
284 284
    const httpParams: HttpParams = this.createParams({lang: language});
285 285
    const options = {params: httpParams};
286 286

  
287
    return this.http.delete(this._userUrl + 'calendar/' + id + '/delete', options)
287
    return this.http.delete(this.baseUrl + '/calendar/' + id + '/delete', options)
288 288
      .pipe(
289 289
        catchError(err => this.handleError(err))
290 290
      );

Také k dispozici: Unified diff