Skip to content

Instantly share code, notes, and snippets.

@kutliev
Created February 11, 2018 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kutliev/34faaad8cd07bbde0e5db9df38fce20f to your computer and use it in GitHub Desktop.
Save kutliev/34faaad8cd07bbde0e5db9df38fce20f to your computer and use it in GitHub Desktop.
Removing entity
removeSpot(spot: Spot) {
return this.removeEntity(spot).map((response: Response) => response.json());
}
removeEvent(event: SpotEvent) {
return this.removeEntity(event).map((response: Response) => response.json());
}
removeEntity(entity: Entity) {
let apiEndPoint = this.settings.ApiEndPoint + "objects/" + entity.slug;
let payload = {
"write_key": this.settings.ApiWriteKey
};
let headers: Headers = new Headers();
headers.append('Content-Type', 'application/json');
let jsonPayload = JSON.stringify(payload);
return this.http.delete(apiEndPoint, {
headers: headers,
body: jsonPayload
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment