Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- changeLimit(newLimit: number):void {
- //console.log(this.userData.getValue());
- if (newLimit > 0 ){
- this.http.post(UserService.serverUrl + "/donation/setLimit", {'limit': newLimit}, {withCredentials:true})
- .map(this._extractData)
- .catch(this._handleError)
- .subscribe(data => {
- if (data.success) {
- let updated = this.getUser();
- updated.donationLimit = data.donationLimit;
- // console.log(updated);
- this.userData.next(updated);
- } else {
- const limitError:ErrorMessage = {
- 'level': ErrorLevel.CRITICAL,
- 'message': "Limit change failed, retry again in a few minutes, if it fails again, contact support",
- 'source': "Donations",
- }
- this.errorMessage.next(limitError)
- }
- })
- } else {
- const limitError:ErrorMessage = {
- 'level': ErrorLevel.IMPORTANT,
- 'message': "Limit change failed, your limit is less than zero",
- 'source': "Donations",
- }
- this.errorMessage.next(limitError);
- }
- // console.log(this.userData.getValue());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement