import { Component } from '@angular/core';
import { Recipe } from '../../interfaces/services/api-fit/response/recipe.interface';
import { ApiFitService } from '../../services/api-fit/api-fit.service';

@Component({
  selector: 'app-recommended-recipes',
  templateUrl: './recommended-recipes.component.html',
  styleUrls: ['./recommended-recipes.component.scss'],
})
export class RecommendedRecipesComponent {
  recommendedRecipes: Recipe[] = [];

  constructor(private apiFitService: ApiFitService) {}

  ngOnInit() {
    this.fetchRecipes();
  }

  fetchRecipes() {
    this.apiFitService.getRecommendedRecipes().subscribe({
      next: (r) => (this.recommendedRecipes = r.data),
    });
  }
}
