Created
February 11, 2018 19:42
-
-
Save kutliev/34faaad8cd07bbde0e5db9df38fce20f to your computer and use it in GitHub Desktop.
Removing entity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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