resolution bug categorie vide

This commit is contained in:
Thomas Cardon 2022-03-10 15:55:15 +01:00
parent 4528d03909
commit 3c2ff28746
2 changed files with 5 additions and 6 deletions

View File

@ -131,10 +131,10 @@ export class AddRestauComponent implements OnInit {
this.apiBackService.addRestaurant(restaurant).subscribe( this.apiBackService.addRestaurant(restaurant).subscribe(
resp => { resp => {
this.initForm(EMPTY_RESTAU) this.initForm(EMPTY_RESTAU)
this.successMessage = "Restaurant ajouté !"
this.cleanCheckbox() this.cleanCheckbox()
this.successMessage = "Restaurant ajouté !"
this.router.navigate(['admin'])
//this.router.navigate(['restaurants'])
} }
); );
this.initForm(EMPTY_RESTAU); this.initForm(EMPTY_RESTAU);
@ -181,7 +181,6 @@ export class AddRestauComponent implements OnInit {
} }
} }
ngOnDestroy() { ngOnDestroy() {
if (this.idRestau) { if (this.idRestau) {
this.idRestau.unsubscribe(); this.idRestau.unsubscribe();

View File

@ -62,12 +62,12 @@ export class RestoPageComponent implements OnInit {
restauByCat: this.apiBackService.restoByCat restauByCat: this.apiBackService.restoByCat
}).subscribe(({ restaurants, user, restauByCat }) => { }).subscribe(({ restaurants, user, restauByCat }) => {
if (this.beforeRoute === "filtres") { if (this.beforeRoute === "filtres") {
this.listRestaurants = this.apiBackService.restoFilter; this.listRestaurants = this.apiBackService.restoFilter;
} else if (this.beforeRoute === "categories" && restauByCat.length > 0) { this.apiBackService.restoFilter = restaurants;
} else if (this.beforeRoute === "categories") {
this.listRestaurants = restauByCat this.listRestaurants = restauByCat
this.apiBackService.restoByCat = of([]); this.apiBackService.restoByCat = of(restaurants);
} else { } else {
this.listRestaurants = restaurants; this.listRestaurants = restaurants;
} }