mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
add show total users in rocket chat server
This commit is contained in:
@@ -1,19 +1,23 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { StorageService } from './storage.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { User } from '../models/user.model';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { HttpService } from './http.service';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { AuthConnstants } from '../config/auth-constants';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AuthService {
|
||||
|
||||
|
||||
|
||||
userData$ = new BehaviorSubject<any>('');
|
||||
constructor(
|
||||
private http: HttpClient
|
||||
private http: HttpClient,
|
||||
private httpService: HttpService,
|
||||
private storageService:StorageService,
|
||||
private router:Router
|
||||
) { }
|
||||
|
||||
public ValidatedUser:User;
|
||||
@@ -31,12 +35,40 @@ export class AuthService {
|
||||
if (result)
|
||||
{
|
||||
this.ValidatedUser = user;
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
logout(){
|
||||
this.ValidatedUser = null;
|
||||
|
||||
}
|
||||
|
||||
loginChat(){
|
||||
const body = {"user": "admin","password": "tabteste@006"};
|
||||
const url = "http://192.168.100.111:3000/api/v1/login";
|
||||
return this.http.post(url, body);
|
||||
}
|
||||
|
||||
//Login to rocketChat server
|
||||
loginChat2(postData: any):Observable<any> {
|
||||
return this.httpService.post('login', postData);
|
||||
}
|
||||
|
||||
//Get user data from RocketChat
|
||||
getUserData(){
|
||||
this.storageService.get(AuthConnstants.AUTH).then(res=>{
|
||||
this.userData$.next(res);
|
||||
})
|
||||
}
|
||||
|
||||
logoutChat(){
|
||||
//this.storageService.clear();
|
||||
this.storageService.removeStorageItem(AuthConnstants.AUTH).then(res =>{
|
||||
this.userData$.next('');
|
||||
this.router.navigate(['']);
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user