Skip to content

Commit 56b5b80

Browse files
committed
Merge branch 'delete-record-method' of https://github.com/MariiaPunda/angular2-jsonapi into MariiaPunda-delete-record-method
2 parents 4120437 + 2f6c380 commit 56b5b80

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/services/json-api-datastore.service.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ export class JsonApiDatastore {
7575
.catch((res: any) => this.handleError(res));
7676
}
7777

78+
deleteRecord<T extends JsonApiModel>(modelType: ModelType<T>, id: string, headers?: Headers): Observable<Response> {
79+
let options: RequestOptions = this.getOptions(headers);
80+
let url: string = this.buildUrl(modelType, null, id);
81+
return this.http.delete(url, options)
82+
.catch((res: any) => this.handleError(res));
83+
}
84+
7885
peekRecord<T extends JsonApiModel>(modelType: ModelType<T>, id: string): T {
7986
let type: string = Reflect.getMetadata('JsonApiModelConfig', modelType).type;
8087
return this._store[type] ? this._store[type][id] : null;

0 commit comments

Comments
 (0)