Skip to content

Instantly share code, notes, and snippets.

@stefansheva
Created April 19, 2020 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefansheva/5131323a49c70433e3f5d4749ce285ce to your computer and use it in GitHub Desktop.
Save stefansheva/5131323a49c70433e3f5d4749ce285ce to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { environment } from '../environments/environment';
import { map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class PageService {
constructor(private http: HttpClient) { }
getAllPages() {
return this.http.get(`${environment.apiUrl}/pages`).pipe(map(res => res));
}
getPage(pageId) {
return this.http.get(`${environment.apiUrl}/pages/${pageId}`).pipe(map(res => res));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment