patch(
    action: string,
    body = '',
    headers: { [key: string]: string } = {}
  ): Observable<any> {
    let url: string = environment['api'] + action

    headers['Content-Type'] = 'application/json'

    let options = new RequestOptions({
      headers: new Headers(headers),
    })

    return this._http
      .patch(url, body, options)
      .map(this._extract)
      .catch(this._handleError)
  }
Example #2
0
 patch(url: string, body: any, options?: RequestOptionsArgs) {
     options = this.getOptions(options);
     return this.http.patch(url, body, options);
 }
Example #3
0
 patch(url: string, body: string, options?: RequestOptions): Observable<Response> {
   return this.http.patch(this.url(url), body, this.requestOptions(options));
 }
 private updateData(data_url, data): Promise<any> {
   return this.http.patch(data_url, data)
     .toPromise()
     .then(this.extractData)
     .catch(this.handleError);
 }
 /**
  * Update an existing draft with new information.
  * PATCH: /api/drafts/update
  *
  * @param draft The draft to update.
  * @returns {Observable<Draft>}   The draft returned from the server.
  */
 public updateDraft(draft : Draft) : Observable<Draft> {
     return this.http.patch('/api/drafts/update', draft, this.headersWithAuth())
         .map(this.parseJson)
         .map(this.createDraftModel)
         .catch(this.handleError);
 }
Example #6
0
 patchElement(id: string, element: any) {
     return this.http.patch(id, element, { headers: this.headers });
 }
Example #7
0
 update(post){
   return this.http.patch(this.url+"/"+post.id,JSON.stringify(post))
   .catch(this.hanldeError);
 }
Example #8
0
 return this.getPostData(url, body, options, (url: string, options: RequestOptionsArgs) => {
     return this.http.patch(url, body.options);
 });
Example #9
0
 return new Promise((resolve, reject) => {
   this.handleRequest(this.http.patch(LoopbackAPI.URL(url, params), JSON.stringify(body), options), resolve, reject);
 });
Example #10
0
 httpPatch(url: string, body = {}, options = {}) {
   return this.http.patch(this.wpApiLoader.getWebServiceUrl(url), body, options);
 }