-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(FEAT) Demanda Insatisfecha: pasar funcionalidad a API #3002
Conversation
@@ -53,7 +53,7 @@ export class demandaInsatisfechaComponent { | |||
|
|||
guardar() { | |||
if (this.motivo && this.tipoPrestacion) { | |||
if (this.serviceListaEspera.guardar(this.paciente, this.tipoPrestacion, this.estado, this.profesional, this.organizacion, this.motivo.nombre, this.origen)) { | |||
if (this.listaEsperaService.save(this.paciente, this.tipoPrestacion, this.estado, this.profesional, this.organizacion, this.motivo.nombre, this.origen)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
El problema de hacer esto (entiendo que ya estaba así) es que la respuesta del save es asincrona, es decir, lo que retorna es una promesa y recien a la vuelta de la api se obtiene el valor. Por lo tanto el if en primera instancia siempre va a dar true.
Lo correcto sería eliminar el if y dejar solo el llamado y, a la vuelta del subscribe, segun sea exito o error se muestra el toast correspondiente:
if (this.listaEsperaService.save(this.paciente, this.tipoPrestacion, this.estado, this.profesional, this.organizacion, this.motivo.nombre, this.origen)) { | |
this.listaEsperaService.save(this.paciente, this.tipoPrestacion, this.estado, this.profesional, this.organizacion, this.motivo.nombre, this.origen).subscribe(respuesta => { | |
complete: () => { | |
*** exito *** | |
}, | |
error: () => { | |
*** error *** | |
} | |
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hecho
da79787
to
3edb37c
Compare
Requerimiento
https://proyectos.andes.gob.ar/browse/CIT-268
Funcionalidad desarrollada
UserStory llegó a completarse
Requiere actualizaciones en la base de datos
Requiere actualizaciones en la API
Requiere actualizaciones en andes-test-integracion