From 3c2ff2874617fc07bd4e448c4871b13e612206b7 Mon Sep 17 00:00:00 2001 From: Thomas Cardon Date: Thu, 10 Mar 2022 15:55:15 +0100 Subject: [PATCH] resolution bug categorie vide --- src/app/admin-component/add-restau/add-restau.component.ts | 5 ++--- src/app/pages/resto-page/resto-page.component.ts | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/app/admin-component/add-restau/add-restau.component.ts b/src/app/admin-component/add-restau/add-restau.component.ts index f5978d5..36f0a56 100644 --- a/src/app/admin-component/add-restau/add-restau.component.ts +++ b/src/app/admin-component/add-restau/add-restau.component.ts @@ -131,10 +131,10 @@ export class AddRestauComponent implements OnInit { this.apiBackService.addRestaurant(restaurant).subscribe( resp => { this.initForm(EMPTY_RESTAU) - this.successMessage = "Restaurant ajouté !" this.cleanCheckbox() + this.successMessage = "Restaurant ajouté !" + this.router.navigate(['admin']) - //this.router.navigate(['restaurants']) } ); this.initForm(EMPTY_RESTAU); @@ -181,7 +181,6 @@ export class AddRestauComponent implements OnInit { } } - ngOnDestroy() { if (this.idRestau) { this.idRestau.unsubscribe(); diff --git a/src/app/pages/resto-page/resto-page.component.ts b/src/app/pages/resto-page/resto-page.component.ts index 26240b0..b449e79 100644 --- a/src/app/pages/resto-page/resto-page.component.ts +++ b/src/app/pages/resto-page/resto-page.component.ts @@ -62,12 +62,12 @@ export class RestoPageComponent implements OnInit { restauByCat: this.apiBackService.restoByCat }).subscribe(({ restaurants, user, restauByCat }) => { - if (this.beforeRoute === "filtres") { 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.apiBackService.restoByCat = of([]); + this.apiBackService.restoByCat = of(restaurants); } else { this.listRestaurants = restaurants; }