Fixed getAllArticles() method in Article Service by adding timestamp to API request (yes this took me hours to figure out)
This commit is contained in:
1 parent
dae95810f2
commit
e6c0a2400a
2 files changed
+4
-2
No files matched your search
@@ -80,7 +80,8 @@ export const routes: Routes = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'blog/:slug',
|
path: 'blog/:slug',
|
||||||
component: ArticlePageComponent },
|
component: ArticlePageComponent
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '**',
|
path: '**',
|
||||||
pathMatch: 'full',
|
pathMatch: 'full',
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ export class ArticleService {
|
|||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
|
|
||||||
getAllArticles(): Observable<Article[]> {
|
getAllArticles(): Observable<Article[]> {
|
||||||
return this.http.get<Article[]>(this.apiUrl);
|
const timeStampedUrl = "/api/articles?timestamp=" + new Date().getTime();
|
||||||
|
return this.http.get<Article[]>(timeStampedUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
getArticleBySlug(slug: string): Observable<Article |undefined> {
|
getArticleBySlug(slug: string): Observable<Article |undefined> {
|
||||||
|
|||||||
Reference in new issue
Block a user