You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.5 KiB
TypeScript
38 lines
1.5 KiB
TypeScript
import { HttpHeaders } from '@angular/common/http';
|
|
import { Injectable } from '@angular/core';
|
|
import { Observable } from 'rxjs';
|
|
import { environment } from '../../../environments/environment';
|
|
import { UserInvitationCriteria } from '../../models/criteria/invitation/UserInvitationCriteria';
|
|
import { RequestItem } from '../../models/criteria/RequestItem';
|
|
import { Invitation } from '../../models/invitation/Invitation';
|
|
import { User } from '../../models/invitation/User';
|
|
import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service';
|
|
|
|
@Injectable()
|
|
export class InvitationService {
|
|
|
|
private actionUrl: string;
|
|
private headers: HttpHeaders;
|
|
|
|
constructor(private http: BaseHttpService) {
|
|
|
|
this.actionUrl = environment.Server + 'invite/';
|
|
|
|
this.headers = new HttpHeaders();
|
|
this.headers = this.headers.set('Content-Type', 'application/json');
|
|
this.headers = this.headers.set('Accept', 'application/json');
|
|
}
|
|
|
|
public inviteUsers(invitation: Invitation): Observable<User[]> {
|
|
return this.http.post<User[]>(this.actionUrl + 'users', invitation, { headers: this.headers });
|
|
}
|
|
|
|
public getUsers(usersInvitationRequestItem: RequestItem<UserInvitationCriteria>): Observable<User[]> {
|
|
return this.http.post<User[]>(this.actionUrl + 'getUsers', usersInvitationRequestItem, { headers: this.headers });
|
|
}
|
|
|
|
public exchange(id: String): Observable<String> {
|
|
return this.http.get<String>(this.actionUrl + 'exchange/' + id, { headers: this.headers });
|
|
}
|
|
}
|