mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 13:26:08 +00:00
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { HttpHeaders } from '@angular/common/http';
|
|
import { Injectable } from '@angular/core';
|
|
import { Observable } from "rxjs"
|
|
import { AuthService } from './auth.service';
|
|
import { HttpService } from './http.service';
|
|
import { StorageService } from './storage.service';
|
|
import { HttpClient, HttpHeaderResponse } from '@angular/common/http';
|
|
import { environment } from 'src/environments/environment';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class ChatService {
|
|
headers: HttpHeaders;
|
|
options:any;
|
|
|
|
|
|
constructor(
|
|
private http:HttpClient,
|
|
private httpService: HttpService,
|
|
private authService: AuthService,
|
|
private storageService:StorageService,) {
|
|
this.headers = new HttpHeaders();
|
|
this.authService.userData$.subscribe((res:any)=>{
|
|
this.headers = this.headers.set('X-User-Id', res.userId);
|
|
this.headers = this.headers.set('X-Auth-Token', res.authToken);
|
|
});
|
|
this.options = {
|
|
headers: this.headers,
|
|
};
|
|
}
|
|
|
|
getAllUsers(){
|
|
/* console.log(this.headers); */
|
|
return this.http.get(environment.apiChatUrl+'users.list', this.options);
|
|
}
|
|
getAllConnectedUsers(){
|
|
return this.http.get(environment.apiChatUrl+'users.presence', this.options);
|
|
}
|
|
getAllPrivateGroups(){
|
|
return this.http.get(environment.apiChatUrl+'groups.list', this.options);
|
|
}
|
|
}
|