Updating observable on webscoket event
Change-Id: I8325785b8d40b646ea67f28b61b8d603803a571e
diff --git a/src/app/hello.ts b/src/app/hello.ts
index 554b2de..8757cc3 100644
--- a/src/app/hello.ts
+++ b/src/app/hello.ts
@@ -2,31 +2,39 @@
import {Component, OnInit} from '@angular/core';
import {StyleConfig} from './config/style.config';
import {CoreService} from './services/rest/core.service';
+import {InstanceStore} from './services/stores/instance.store';
+import {IInstance} from './interfaces/instance.interface';
@Component({
selector: 'xos-app',
template: require('./hello.html'),
- providers: [CoreService],
+ providers: [CoreService, InstanceStore],
})
export class HelloComponent implements OnInit {
// declare class properties
public hello: string;
- public endpoints: any[];
+ public instances: IInstance[];
- constructor(private coreService: CoreService) {
+ constructor(
+ private coreService: CoreService,
+ private instanceStore: InstanceStore
+ ) {
this.hello = `Hello ${StyleConfig.projectName}!`;
- this.endpoints = [];
+ this.instances = [];
}
ngOnInit() {
console.log('on init');
- this.coreService.getCoreEndpoints()
+ this.instanceStore.query()
.subscribe(
- endpoints => {
- this.endpoints = endpoints;
+ instances => {
+ console.log(instances);
+ this.instances = instances;
},
- err => console.log
+ err => {
+ console.warn(err);
+ }
);
}
}