calendrier : fin + gestion des roles + debug

This commit is contained in:
Hedi 2022-03-01 18:37:35 +01:00
parent 68aae07bb3
commit cd8a67a9e7

View File

@ -2,7 +2,7 @@ import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core';
import { DayPilot, DayPilotCalendarComponent, DayPilotNavigatorComponent } from "@daypilot/daypilot-lite-angular"; import { DayPilot, DayPilotCalendarComponent, DayPilotNavigatorComponent } from "@daypilot/daypilot-lite-angular";
import { EvenementService } from 'src/app/services/evenement.service'; import { EvenementService } from 'src/app/services/evenement.service';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import jwt_decode from 'jwt-decode'; import { TokenService } from 'src/app/services/token.service';
@Component({ @Component({
selector: 'app-page-agenda', selector: 'app-page-agenda',
@ -20,7 +20,7 @@ export class PageAgendaComponent implements AfterViewInit {
@ViewChild("navigator") navigator!: DayPilotNavigatorComponent; @ViewChild("navigator") navigator!: DayPilotNavigatorComponent;
@ViewChild("calendar") calendar!: DayPilotCalendarComponent; @ViewChild("calendar") calendar!: DayPilotCalendarComponent;
constructor(private evenementService:EvenementService) { constructor(private evenementService:EvenementService, private tokenService: TokenService) {
this.isShow = false; this.isShow = false;
this.alert = ""; this.alert = "";
this.debug = environment.debug; this.debug = environment.debug;
@ -56,15 +56,8 @@ export class PageAgendaComponent implements AfterViewInit {
} }
ngOnInit(): void { ngOnInit(): void {
const token = localStorage.getItem(environment.tokenKey); this.userId = this.tokenService.getCurrentMembreId();
if(token) { this.teamId = this.tokenService.getCurrentTeamId();
const decodedToken = jwt_decode<any>(token);
this.userId = decodedToken.userId;
this.teamId = decodedToken.teamId;
this.role = decodedToken.auth[0].authority;
}else{
//
}
} }
// petite triche pour eviter la repetition du nom dans le RDV // petite triche pour eviter la repetition du nom dans le RDV