diff --git a/src/web/domain/presentation/dashboard/atendente/visualizar-atendente/visualizar-atendente.component.ts b/src/web/domain/presentation/dashboard/atendente/visualizar-atendente/visualizar-atendente.component.ts
index d13ee0ce..d174d920 100644
--- a/src/web/domain/presentation/dashboard/atendente/visualizar-atendente/visualizar-atendente.component.ts
+++ b/src/web/domain/presentation/dashboard/atendente/visualizar-atendente/visualizar-atendente.component.ts
@@ -23,7 +23,7 @@ export class VisualizarAtendenteComponent implements OnInit {
*
* @type {Atendente}
*/
- atendente: Atendente = new Atendente();
+ atendente: any;
/**
*
@@ -47,7 +47,7 @@ export class VisualizarAtendenteComponent implements OnInit {
* @param {string} atendenteKey
*/
public find(atendenteKey: string) {
- this.atendenteService.findOne(atendenteKey).subscribe(atendente => this.atendente = atendente)
+ this.atendenteService.findOne(atendenteKey).snapshotChanges().subscribe(atendente => this.atendente = atendente)
}
/**
diff --git a/src/web/domain/presentation/dashboard/unidade/consultar-unidades/consultar-unidades.component.ts b/src/web/domain/presentation/dashboard/unidade/consultar-unidades/consultar-unidades.component.ts
index df180f14..618d8006 100644
--- a/src/web/domain/presentation/dashboard/unidade/consultar-unidades/consultar-unidades.component.ts
+++ b/src/web/domain/presentation/dashboard/unidade/consultar-unidades/consultar-unidades.component.ts
@@ -40,8 +40,8 @@ export class ConsultarUnidadesComponent implements OnInit {
*
*/
public listUnidadesByFilters() {
- this.unidadeService.find().snapshotChanges().subscribe(asdf=> {
- this.unidades = asdf;
+ this.unidadeService.find().snapshotChanges().subscribe(result => {
+ this.unidades = result;
});
}
diff --git a/src/web/domain/service/atendente.service.ts b/src/web/domain/service/atendente.service.ts
index 8b5e500f..99056482 100644
--- a/src/web/domain/service/atendente.service.ts
+++ b/src/web/domain/service/atendente.service.ts
@@ -1,18 +1,13 @@
import {Injectable} from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {AbstractService} from "./abstract.service";
-import {AngularFireDatabase} from "angularfire2/database";
+import {AngularFireDatabase, AngularFireList, AngularFireObject} from "angularfire2/database";
import {Observable} from "rxjs/Observable";
import {Atendente} from "../entity/atendente/atendente.model";
@Injectable()
export class AtendenteService extends AbstractService {
- /**
- * TODO mudar para o model
- */
- atendentes: any[];
-
constructor(private af: AngularFireDatabase, private httpClient: HttpClient) {
super();
}
@@ -21,12 +16,12 @@ export class AtendenteService extends AbstractService {
return this.httpClient.post(this.baseUrl + 'atendentes', atendente).toPromise();
}
- public find(): Observable
{
- return this.af.list('atendentes').valueChanges();
+ public find(): AngularFireList {
+ return this.af.list('atendentes');
}
- public findOne(key: string): Observable {
- return this.af.object('atendentes/' + key).valueChanges();
+ public findOne(key: string): AngularFireObject {
+ return this.af.object('atendentes/' + key);
}
public update(atendente: Atendente): Promise {
diff --git a/src/web/domain/service/unidade.service.ts b/src/web/domain/service/unidade.service.ts
index cbb5bedf..d5c852d7 100644
--- a/src/web/domain/service/unidade.service.ts
+++ b/src/web/domain/service/unidade.service.ts
@@ -10,11 +10,6 @@ import {FirebaseListObservable} from "angularfire2/database-deprecated";
@Injectable()
export class UnidadeService extends AbstractService {
- /**
- * TODO mudar para o model
- */
- unidades: any[];
-
constructor(private af: AngularFireDatabase, private httpClient: HttpClient) {
super();
}
@@ -24,8 +19,6 @@ export class UnidadeService extends AbstractService {
}
public find(): AngularFireList {
-
- // this.unidadeService.find().snapshotChanges().subscribe(
return this.af.list('unidades');
}