latest
This commit is contained in:
@@ -73,6 +73,7 @@
|
||||
<br>
|
||||
<br>
|
||||
<div>
|
||||
<p *ngIf="defaultPaymentSet">Default payment set successfully!</p>
|
||||
<md-tab-group (selectedIndexChange)="selectedIndexChange($event)" [selectedIndex]="selectedBillingTab">
|
||||
<md-tab label="List of Credit Cards">
|
||||
<form (ngSubmit)="setDefaultPayment()" method="post">
|
||||
|
||||
@@ -40,6 +40,7 @@ export class MyProfileComponent implements OnInit {
|
||||
private selectedBillingTab:number = 0;
|
||||
|
||||
private defaultUserPaymentId:number;
|
||||
private defaultPaymentSet:boolean;
|
||||
|
||||
constructor (private paymentService:PaymentService, private loginService: LoginService, private userService: UserService, private router: Router){
|
||||
}
|
||||
@@ -103,7 +104,8 @@ export class MyProfileComponent implements OnInit {
|
||||
onNewPayment () {
|
||||
this.paymentService.newPayment(this.userPayment).subscribe(
|
||||
res => {
|
||||
location.reload();
|
||||
this.getCurrentUser();
|
||||
this.selectedBillingTab = 0;
|
||||
},
|
||||
error => {
|
||||
console.log(error.text());
|
||||
@@ -120,7 +122,8 @@ export class MyProfileComponent implements OnInit {
|
||||
onRemovePayment(id:number) {
|
||||
this.paymentService.removePayment(id).subscribe(
|
||||
res => {
|
||||
location.reload();
|
||||
this.getCurrentUser();
|
||||
|
||||
},
|
||||
error => {
|
||||
console.log(error.text());
|
||||
@@ -129,10 +132,13 @@ export class MyProfileComponent implements OnInit {
|
||||
}
|
||||
|
||||
setDefaultPayment() {
|
||||
this.defaultPaymentSet=false;
|
||||
this.paymentService.setDefaultPayment(this.defaultUserPaymentId).subscribe(
|
||||
res => {
|
||||
console.log(res.text());
|
||||
location.reload();
|
||||
this.getCurrentUser();
|
||||
this.defaultPaymentSet=true;
|
||||
// this.selectedProfileTab = 2;
|
||||
// this.selectedBillingTab = 0;
|
||||
},
|
||||
error => {
|
||||
console.log(error.text());
|
||||
@@ -140,16 +146,7 @@ export class MyProfileComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loginService.checkSession().subscribe(
|
||||
res => {
|
||||
this.loggedIn=true;
|
||||
},
|
||||
error => {
|
||||
this.loggedIn=false;
|
||||
}
|
||||
);
|
||||
|
||||
getCurrentUser() {
|
||||
this.userService.getCurrentUser().subscribe(
|
||||
res => {
|
||||
this.user=res.json();
|
||||
@@ -166,6 +163,19 @@ export class MyProfileComponent implements OnInit {
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loginService.checkSession().subscribe(
|
||||
res => {
|
||||
this.loggedIn=true;
|
||||
},
|
||||
error => {
|
||||
this.loggedIn=false;
|
||||
}
|
||||
);
|
||||
|
||||
this.getCurrentUser();
|
||||
|
||||
for (let s in AppConst.usStates) {
|
||||
this.stateList.push(s);
|
||||
@@ -176,6 +186,7 @@ export class MyProfileComponent implements OnInit {
|
||||
this.userPayment.expiryMonth="";
|
||||
this.userPayment.expiryYear="";
|
||||
this.userPayment.userBilling = this.userBilling;
|
||||
this.defaultPaymentSet=false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user