This commit is contained in:
Peter Maquiran
2021-09-28 11:31:10 +01:00
parent 9e21bdb452
commit c2243c8029
13 changed files with 171 additions and 21 deletions
+19 -4
View File
@@ -6,6 +6,7 @@ import { environment } from 'src/environments/environment';
import { AuthService } from '../services/auth.service';
import { LoginUserRespose, UserSession } from '../models/user.model';
import { EventList } from '../models/agenda/AgendaEventList';
import { ChangeProfileService } from './change-profile.service';
@Injectable({
@@ -27,8 +28,13 @@ export class EventsService {
headersSharedPessoal: HttpHeaders;
//lastloadedevent: Event;
constructor(private http: HttpClient, user: AuthService) {
this.loggeduser = user.ValidatedUser;
constructor(
private http: HttpClient,
public user: AuthService,
private changeProfileService: ChangeProfileService)
{
this.loggeduser = this.user.ValidatedUser;
this.headersMdOficial = new HttpHeaders();
this.headersMdPessoal = new HttpHeaders();
@@ -39,6 +45,17 @@ export class EventsService {
this.headersSharedOficial = new HttpHeaders();
this.headersSharedPessoal = new HttpHeaders();
this.setHeader()
this.changeProfileService.registerCallback(()=>{
this.loggeduser = this.user.ValidatedUser;
this.setHeader()
})
}
setHeader() {
if(this.loggeduser){
if(this.loggeduser.Profile == 'MDGPR') {
@@ -89,8 +106,6 @@ export class EventsService {
this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
}
}
/* getAllEvents(startdate:string, enddate:string): Observable<Event[]>{