Skip to content
Snippets Groups Projects
Commit 9ecce39a authored by Hugo BAYOUD's avatar Hugo BAYOUD
Browse files

handle error is bars component fetching bars

parent 8d3613af
Branches
No related tags found
1 merge request!1Resolve "[FRONT] Créer la page : choix des bars"
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs'; import { EMPTY, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators'; import { catchError, map } from 'rxjs/operators';
import { Bar } from '../../share/models/bar.model'; import { Bar } from '../../share/models/bar.model';
import { BarsService } from '../../share/services/bars.service'; import { BarsService } from '../../share/services/bars.service';
...@@ -17,12 +17,12 @@ export class BarsComponent implements OnInit { ...@@ -17,12 +17,12 @@ export class BarsComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.barsService.getAllBars().pipe( this.barsService.getAllBars().pipe(
map((bars: Bar[]) => { map((bars: Bar[]) => {
console.log(bars);
this.bars = bars; this.bars = bars;
}), }),
catchError((err) => { catchError((error: any) => {
console.log(err); return EMPTY;
}) }
),
); );
} }
} }
...@@ -24,9 +24,6 @@ export class BarsEffect { ...@@ -24,9 +24,6 @@ export class BarsEffect {
}), }),
map((bars: Bar[]) => { map((bars: Bar[]) => {
return new FetchBarsSuccess(bars); return new FetchBarsSuccess(bars);
}), })
// catchError((err) => {
// console.log(err);
// })
); );
} }
\ No newline at end of file
import { PhotosAction, PhotosActionsTypes } from "./photos.actions";
import { Photo } from "../models/photo.model";
import { Bar } from "../../models/bar.model"; import { Bar } from "../../models/bar.model";
import { BarsAction, BarsActionsTypes } from "../actions/bars.actions"; import { BarsAction, BarsActionsTypes } from "../actions/bars.actions";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment