Ejemplo n.º 1
0
 updateBook(id: string, data: any): Observable<any> {
   const url = `${apiUrl}/${id}`;
   return this.http
     .put(url, data, httpOptions)
     .pipe(catchError(this.handleError));
 }
 getBooks(): Observable<any> {
   return this.http.get(apiUrl, httpOptions).pipe(
     map(this.extractData),
     catchError(this.handleError));
 }
 postBook(data): Observable<any> {
   return this.http.post(apiUrl, data, httpOptions)
     .pipe(
       catchError(this.handleError)
     );
 }
Ejemplo n.º 4
0
 GetPostHtml(url: string): Observable<string> {
   // note that this.httpClient is not generic 
   return this.httpClient.get(this.noCache(url), {responseType:'text'}).pipe(tap(_ => this.log(`GetPostHtml`)), catchError(this.handleError<string>('GetPostHtml', null)));
 }
 .pipe(mergeMap(() => ajax.getJSON<IViewData>(`api/viewdata/${selectedView.id}`).pipe(catchError(() => EMPTY))))
Ejemplo n.º 6
0
 GetActiveSites(): Observable<Site[]> {
   let url = this.serviceURL + 'GetActiveSites';
   return this.httpClient.get<Site[]>(this.noCache(url)).pipe(tap(_ => this.log(`GetActiveSites`)), catchError(this.handleError<Site[]>('GetActiveSites', [])));
 }
Ejemplo n.º 7
0
 GetContentItemBySlug(slug: string, siteID: number): Observable<ContentItem> {
   let url = this.serviceURL + 'GetContentItemBySlug?slug=' + slug + '&siteID=' + siteID.toString();
   return this.httpClient.get<ContentItem>(this.noCache(url)).pipe(tap(_ => this.log(`GetContentItemBySlug`)), catchError(this.handleError<ContentItem>('GetContentItemBySlug', null)));
   //return this.http.get(this.noCache(url)).pipe(map(response => this.extractData(response)));
   //.catch(this.handleError);
 }
 getAllFood(): Observable<FoodItem[]> {
     return this._http.get<FoodItem[]>(this.actionUrl).pipe(catchError(this.handleError));
 }
 getSingleFood(id: number): Observable<FoodItem> {
     return this._http.get<FoodItem>(this.actionUrl + id).pipe(catchError(this.handleError));
 }
Ejemplo n.º 10
0
 saveEmail(texte){
   let url = apiUrl+"/updateEmail";
   return this.http.put(url,texte,httpOptions).pipe(
     map(this.extractData),
     catchError(this.handleError));
 }