From b490318fde6eff1deecaf6c59dba7e09d4903a81 Mon Sep 17 00:00:00 2001 From: Fernando Dodino Date: Mon, 18 Nov 2024 09:59:49 -0300 Subject: [PATCH] using retry --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3b7e006..73d6552 100644 --- a/README.md +++ b/README.md @@ -345,7 +345,13 @@ export class TareasService { todasLasTareas() { return this.httpClient .get(REST_SERVER_URL + '/tareas') - .pipe(map((tareasJSON: TareaJSON[]) => tareasJSON.map((tareaJSON: TareaJSON) => Tarea.fromJson(tareaJSON) ?? []))) + .pipe( + map((tareasJSON: TareaJSON[]) => { + console.info('tareas JSON', tareasJSON) + return tareasJSON.map((tareaJSON: TareaJSON) => Tarea.fromJson(tareaJSON) ?? []) + }), + retry(2) // podemos pedir que intente n veces + ) } getTareaById(id: number) { @@ -377,6 +383,7 @@ export class TareasComponent implements OnInit { ngOnInit() { this.tareas$ = this.tareasService.todasLasTareas() + } ``` Para poder disparar la búsqueda, el html va a usar el **async pipe**: