Attendees Enhancments

This commit is contained in:
Paulo Pinto
2020-08-26 14:24:18 +01:00
parent 97ac242c78
commit e8e47b8680
9 changed files with 187 additions and 48 deletions
+16
View File
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ContactsService } from './contacts.service';
describe('ContactsService', () => {
let service: ContactsService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ContactsService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+38
View File
@@ -0,0 +1,38 @@
import { Injectable } from '@angular/core';
import { EventPerson } from '../models/eventperson.model';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { AuthService } from '../services/auth.service';
import { User } from '../models/user.model';
@Injectable({
providedIn: 'root'
})
export class ContactsService {
authheader = {};
loggeduser: User;
headers: HttpHeaders;
constructor(private http: HttpClient, user: AuthService) {
this.loggeduser = user.ValidatedUser;
this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
}
getContacts(namefilter:string): Observable<EventPerson[]>{
const geturl = environment.apiURL + 'contacts/get';
let params = new HttpParams();
params = params.set("namefilter", namefilter);
params = params.set("domain", environment.domain);
let options = {
headers: this.headers,
params: params
};
return this.http.get<EventPerson[]>(`${geturl}`, options);
}
}
+1 -1
View File
@@ -15,7 +15,7 @@ export class EventsService {
authheader = {};
loggeduser: User;
headers: HttpHeaders;
lastloadedevent: Event;
//lastloadedevent: Event;
constructor(private http: HttpClient, user: AuthService) {
this.loggeduser = user.ValidatedUser;