Last active
March 17, 2017 10:52
-
-
Save pascalwhoop/006ca7d3d5c4e6d20126b0de43597088 to your computer and use it in GitHub Desktop.
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
public orderPost(offerId: string, takeaway: boolean): Observable<Order> { | |
//http call prep code ... | |
//... | |
let obs = this.http.post(path, orderBooking, requestOptions) | |
.map((response: Response) => { | |
if (response.status === 204) { | |
return undefined; | |
} else { | |
return response.json(); | |
} | |
}) | |
.publish(); //ensuring we only have one subscription to pass around, otherwise you get multiple http calls every time | |
obs.connect(); | |
//here we tell the feedback service what we want. we'd like spinning and toasting | |
this.vfeedback.showMessageOnAnswer('Order placed!', 'Oops', obs); | |
this.vfeedback.spinUntilCompleted(obs); | |
return obs; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment