Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. changeLimit(newLimit: number):void {
  2. //console.log(this.userData.getValue());
  3. if (newLimit > 0 ){
  4. this.http.post(UserService.serverUrl + "/donation/setLimit", {'limit': newLimit}, {withCredentials:true})
  5. .map(this._extractData)
  6. .catch(this._handleError)
  7. .subscribe(data => {
  8. if (data.success) {
  9. let updated = this.getUser();
  10. updated.donationLimit = data.donationLimit;
  11. // console.log(updated);
  12. this.userData.next(updated);
  13. } else {
  14. const limitError:ErrorMessage = {
  15. 'level': ErrorLevel.CRITICAL,
  16. 'message': "Limit change failed, retry again in a few minutes, if it fails again, contact support",
  17. 'source': "Donations",
  18. }
  19. this.errorMessage.next(limitError)
  20. }
  21. })
  22. } else {
  23. const limitError:ErrorMessage = {
  24. 'level': ErrorLevel.IMPORTANT,
  25. 'message': "Limit change failed, your limit is less than zero",
  26. 'source': "Donations",
  27. }
  28. this.errorMessage.next(limitError);
  29. }
  30. // console.log(this.userData.getValue());
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement