|
@@ -5,6 +5,7 @@ import {ApiResultModel} from '../models/api-result.model';
|
5
|
5
|
import {AppStateService} from './app-state.service';
|
6
|
6
|
import {VpnStatusModel} from '../models/vpn/vpn-status.model';
|
7
|
7
|
import {DnsStatusModel} from '../models/dns/dns-status.model';
|
|
8
|
+import {share} from 'rxjs/operators';
|
8
|
9
|
|
9
|
10
|
const httpPostOptions = {
|
10
|
11
|
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
|
|
@@ -17,7 +18,7 @@ export class StatusService {
|
17
|
18
|
constructor(private http: HttpClient, private appStateService: AppStateService) { }
|
18
|
19
|
|
19
|
20
|
getVpnStatus(): Observable<ApiResultModel<VpnStatusModel>> {
|
20
|
|
- const obs = this.http.get<ApiResultModel<VpnStatusModel>>(`${this.urlBase}/vpn`);
|
|
21
|
+ const obs = this.http.get<ApiResultModel<VpnStatusModel>>(`${this.urlBase}/vpn`).pipe(share());
|
21
|
22
|
obs.subscribe(vpnStatus => {
|
22
|
23
|
this.appStateService.updateVpnStatus(vpnStatus.data);
|
23
|
24
|
});
|
|
@@ -25,7 +26,7 @@ export class StatusService {
|
25
|
26
|
}
|
26
|
27
|
|
27
|
28
|
getDnsStatus(): Observable<ApiResultModel<DnsStatusModel>> {
|
28
|
|
- const obs = this.http.get<ApiResultModel<DnsStatusModel>>(`${this.urlBase}/dns`);
|
|
29
|
+ const obs = this.http.get<ApiResultModel<DnsStatusModel>>(`${this.urlBase}/dns`).pipe(share());
|
29
|
30
|
obs.subscribe(dnsStatus => {
|
30
|
31
|
this.appStateService.updateDnsStatus(dnsStatus.data);
|
31
|
32
|
});
|