Created
October 21, 2020 09:37
-
-
Save mkubdev/eb7fb6902f19b17501859b5a32b97e50 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable } from '@angular/core'; | |
| import { HttpClient } from '@angular/common/http'; | |
| import { environment } from '../src/environments/environment'; | |
| import { map } from 'rxjs/operators'; | |
| @Injectable({ | |
| providedIn: 'root' | |
| }) | |
| export class ContentService { | |
| constructor(private http: HttpClient) { } | |
| getAllContents() { | |
| return this.http.get(`${environment.apiUrl}/contents`).pipe(map(res => res)); | |
| } | |
| getContent(contentId) { | |
| return this.http.get(`${environment.apiUrl}/contents/${contentId}`).pipe(map(res => res)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment