diff --git a/src/app/services/article.service.ts b/src/app/services/article.service.ts index e01456d..f2e5fdd 100644 --- a/src/app/services/article.service.ts +++ b/src/app/services/article.service.ts @@ -25,19 +25,18 @@ export class ArticleService { constructor(private http: HttpClient) {} getAllArticles(): Observable { - const timeStampedUrl = "/api/articles?timestamp=" + new Date().getTime(); - return this.http.get(timeStampedUrl); + return this.http.get(`${this.apiUrl}?timestamp=${new Date().getTime()}`); } getArticleBySlug(slug: string): Observable
{ - return this.http.get(this.apiUrl).pipe( - map((articles) => articles.find((article) => article.slug === slug)) + return this.http.get
(`${this.apiUrl}/${slug}`).pipe( + map(article => article) ); } getArticleById(id: number): Observable
{ - return this.http.get(this.apiUrl).pipe( - map((articles) => articles.find((article) => article.id === id)) + return this.http.get
(`${this.apiUrl}/${id}`).pipe( + map(article => article) ); }