18 lines
521 B
TypeScript
18 lines
521 B
TypeScript
import { inject, Injectable } from '@angular/core';
|
|
import { HttpClient } from '@angular/common/http';
|
|
import { map, Observable } from 'rxjs';
|
|
import { Recipe, RecipeInfoViews } from './model/Recipe.model';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class RecipeService {
|
|
private readonly http = inject(HttpClient);
|
|
|
|
public getRecipes(): Observable<Recipe[]> {
|
|
return this.http
|
|
.get<RecipeInfoViews>('http://localhost:8080/recipes')
|
|
.pipe(map((res) => res.content));
|
|
}
|
|
}
|