Skip to content

Commit 2f6c380

Browse files
committed
Added delete record with proper http method call
1 parent 61450c8 commit 2f6c380

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(modelType: ModelType, 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(modelType: ModelType, id: string): JsonApiModel {
7986
let type: string = Reflect.getMetadata('JsonApiModelConfig', modelType).type;
8087
return this._store[type] ? this._store[type][id] : null;

0 commit comments

Comments
 (0)