Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { HttpClient } from '@angular/common/http';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import 'rxjs/add/operator/map';
import { UserInfoModel } from './user.info.model';
import { UserFacilityData } from './home.model';
// import 'rxjs/add/operator/do';
// import 'rxjs/add/operator/catch';
import { environment } from './../../../environments/environment';
@Injectable()
export class HomeService {
private selectedStations: any[];
selectedStationNotifier$: BehaviorSubject<any> = new BehaviorSubject(null);
constructor(private http: Http, private _http: HttpClient) {
if (sessionStorage.getItem('activeStations')) {
this.selectedStations = JSON.parse(
sessionStorage.getItem('activeStations')
);
this.selectedStationNotifier$.next(this.selectedStations);
}
}
refreshStats(userName) {
return this._http.get<UserFacilityData>(
`${environment.nodeserver}/login/refreshStats/${userName}`,
{ withCredentials: true }
);
// return this.http
// .get(`${environment.nodeserver}/login/refreshStats/${userName}`, {withCredentials: true})
// .map((response: Response) => response.json());
}
getUserFacilities(userName) {
return this._http.post(
`${environment.nodeserver}/home/getUserFacilities`,
{ userName: userName },
{ withCredentials: true }
);
// return this.http
// .post(`${environment.nodeserver}/home/getUserFacilities`, { userName: userName }, {withCredentials: true})
// .map((response: Response) => response.json());
}
getUserInfo(userName) {
return this._http.post<UserInfoModel>(
`${environment.nodeserver}/fppsLogin/roles`,
{
userName
}
);
}
setActiveStations(selectedStations) {
this.selectedStations = selectedStations;
this.selectedStationNotifier$.next(this.selectedStations);
}
getActiveStaions() {
return this.selectedStations;
}
}