bug restauCateg = ok

This commit is contained in:
Thomas Cardon 2022-03-09 14:52:09 +01:00
parent 8b70164a9f
commit f7d6b0f691

View file

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { forkJoin } from 'rxjs'; import { forkJoin, of } from 'rxjs';
import { ApiBackService } from 'src/app/services/api-back.service'; import { ApiBackService } from 'src/app/services/api-back.service';
import { TokenService } from 'src/app/services/token.service'; import { TokenService } from 'src/app/services/token.service';
import { Preference } from '../models/preference'; import { Preference } from '../models/preference';
@ -30,6 +30,8 @@ export class RestoPageComponent implements OnInit {
this.restauLiked(); this.restauLiked();
this.listRestaurants = [];
this.userId = this.tokenService.getCurrentUserId(); this.userId = this.tokenService.getCurrentUserId();
} }
@ -63,8 +65,9 @@ export class RestoPageComponent implements OnInit {
if (this.beforeRoute === "filtres") { if (this.beforeRoute === "filtres") {
this.listRestaurants = this.apiBackService.restoFilter; this.listRestaurants = this.apiBackService.restoFilter;
}else if(this.beforeRoute === "categories" ){ } else if (this.beforeRoute === "categories" && restauByCat.length > 0) {
this.listRestaurants = restauByCat this.listRestaurants = restauByCat
this.apiBackService.restoByCat = of([]);
} else { } else {
this.listRestaurants = restaurants; this.listRestaurants = restaurants;
} }