Skip to content

Commit

Permalink
Added delete record with proper http method call
Browse files Browse the repository at this point in the history
  • Loading branch information
MariiaPunda committed Oct 7, 2016
1 parent 61450c8 commit 2f6c380
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/services/json-api-datastore.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ export class JsonApiDatastore {
.catch((res: any) => this.handleError(res));
}

deleteRecord(modelType: ModelType, id: string, headers?: Headers): Observable<Response> {
let options: RequestOptions = this.getOptions(headers);
let url: string = this.buildUrl(modelType, null, id);
return this.http.delete(url, options)
.catch((res: any) => this.handleError(res));
}

peekRecord(modelType: ModelType, id: string): JsonApiModel {
let type: string = Reflect.getMetadata('JsonApiModelConfig', modelType).type;
return this._store[type] ? this._store[type][id] : null;
Expand Down

0 comments on commit 2f6c380

Please sign in to comment.