parent
1692adaf42
commit
35126aeec8
@ -1,14 +1,34 @@ |
|||||||
import { Component } from '@angular/core'; |
import { Component, OnInit } from '@angular/core'; |
||||||
|
import { CollaborateurConnecte } from '@shared/globales/collaborateur-connecte' |
||||||
|
import { CollaborateursService } from '@shared/api-swagger/api/api' |
||||||
|
import { AuthService } from '@shared/auth/auth.service'; |
||||||
|
import { Subscription } from 'rxjs'; |
||||||
@Component({ |
@Component({ |
||||||
selector: 'app-root', |
selector: 'app-root', |
||||||
templateUrl: './app.component.html', |
templateUrl: './app.component.html', |
||||||
styleUrls: ['./app.component.css'] |
styleUrls: ['./app.component.css'] |
||||||
}) |
}) |
||||||
export class AppComponent { |
|
||||||
|
export class AppComponent implements OnInit { |
||||||
title = 'EPAClient'; |
title = 'EPAClient'; |
||||||
|
|
||||||
constructor() { |
subscriber: Subscription; |
||||||
|
|
||||||
|
|
||||||
|
constructor(private collaborateurConnecte:CollaborateurConnecte, private collaborateursService: CollaborateursService, |
||||||
|
private authService: AuthService ) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
ngOnInit(): void { |
||||||
|
let mail = this.authService.mail; |
||||||
|
this.subscriber = this.collaborateursService.getCollaborateurByMail(mail).subscribe( |
||||||
|
collaborateur => this.collaborateurConnecte.collaborateur = collaborateur |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
ngOnDestroy(): void { |
||||||
|
if(this.subscriber != undefined) |
||||||
|
this.subscriber.unsubscribe(); |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -0,0 +1,7 @@ |
|||||||
|
import { Injectable } from "@angular/core"; |
||||||
|
import { CollaborateurDTO } from "@shared/api-swagger/model/models"; |
||||||
|
|
||||||
|
@Injectable() |
||||||
|
export class CollaborateurConnecte { |
||||||
|
collaborateur: CollaborateurDTO |
||||||
|
} |
Loading…
Reference in new issue