From e6c0a2400af74501d34ac5cd8477c2e66f7651a9 Mon Sep 17 00:00:00 2001 From: itzMiney Date: Mon, 30 Dec 2024 04:03:01 +0100 Subject: [PATCH] Fixed getAllArticles() method in Article Service by adding timestamp to API request (yes this took me hours to figure out) --- src/app/app.routes.ts | 3 ++- src/app/services/article.service.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index 59a2f1a..573d87a 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -80,7 +80,8 @@ export const routes: Routes = [ }, { path: 'blog/:slug', - component: ArticlePageComponent }, + component: ArticlePageComponent + }, { path: '**', pathMatch: 'full', diff --git a/src/app/services/article.service.ts b/src/app/services/article.service.ts index 0520391..e01456d 100644 --- a/src/app/services/article.service.ts +++ b/src/app/services/article.service.ts @@ -25,7 +25,8 @@ export class ArticleService { constructor(private http: HttpClient) {} getAllArticles(): Observable { - return this.http.get(this.apiUrl); + const timeStampedUrl = "/api/articles?timestamp=" + new Date().getTime(); + return this.http.get(timeStampedUrl); } getArticleBySlug(slug: string): Observable
{