Skip to content

Commit

Permalink
using retry
Browse files Browse the repository at this point in the history
  • Loading branch information
fdodino committed Nov 18, 2024
1 parent 5ab50a2 commit b490318
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,13 @@ export class TareasService {
todasLasTareas() {
return this.httpClient
.get<TareaJSON[]>(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) {
Expand Down Expand Up @@ -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**:
Expand Down

0 comments on commit b490318

Please sign in to comment.