Commit ab8c0345 authored by Dhiraj Shrivastava's avatar Dhiraj Shrivastava
Browse files

fix: resolve refresh issue and update registration confirmation message

parent d6cb35d3
......@@ -74,10 +74,11 @@ export class UserService {
.pipe(
map(user => {
const showStatus = user.body.variables.tpfResponse;
if (showStatus === 200) {
/* if (showStatus === 200) {
this.getBookingData();
return user;
}
} */
return user;
})
);
}
......
......@@ -49,8 +49,8 @@
</div>
<!-- <h4 class="card-title"> Your Bookings </h4> -->
<p style="margin-top: 2%;" *ngIf="this.currentUser.Pnr_Details[0].Record_Locator === ''">No Bookings found!</p>
<table class="table table-striped table-responsive" *ngIf="this.currentUser.Pnr_Details[0].Record_Locator !== ''"
<p style="margin-top: 2%;" *ngIf="this.newUserData.Pnr_Details[0].Record_Locator === ''">No Bookings found!</p>
<table class="table table-striped table-responsive" *ngIf="this.newUserData.Pnr_Details[0].Record_Locator !== ''"
style="overflow-y:scroll;max-height: 318px;">
<tr>
<th>Sr. No.</th>
......@@ -60,7 +60,7 @@
<th>Flight Brd</th>
<th>Flight Off</th>
</tr>
<tbody *ngFor="let item of this.currentUser.Pnr_Details; let i = index " >
<tbody *ngFor="let item of this.newUserData.Pnr_Details; let i = index " >
<tr *ngIf="item.Record_Locator !== ''" >
<td style="color: #3f51b5 !important;font-size: 12px !important;">{{i+1}}. </td>
<td style="color: #3f51b5 !important;font-size: 12px !important;">{{item.Record_Locator}} </td>
......
......@@ -47,6 +47,7 @@ export class HomeComponent implements OnInit, OnDestroy {
private loadAllUsers() {
let user = localStorage.getItem("UserData");
this.newUserData = JSON.parse(user);
//this.currentUser = JSON.parse(user);
console.log("new user nn-", this.newUserData.Pnr_Details);
......
......@@ -167,13 +167,21 @@ export class NewBookingComponent implements OnInit {
const showStatus = data.body.variables.tpfResponse;
console.log("Return data of new booking-", showStatus);
if (showStatus === 200) {
this.loading = false;
this.alertService.success('You Have Booked flight Successful', true);
// this.currentUserSubscription = this.authenticationService.currentUser.subscribe(user => {
// this.currentUser = user;
// this.router.navigate(['/home']);
// });
this.router.navigate(['/home']);
let password = localStorage.getItem("CurrentPassword");
let fqtv = localStorage.getItem("CurrentFqtv");
this.userService.getAll(fqtv, password)
.pipe()
.subscribe(nbdata => {
this.userService.populateUserModel(localStorage, nbdata, fqtv);
this.loading = false;
this.alertService.success('Your flight booking request completed successfully', true);
console.log('User data after booking...', JSON.parse(localStorage.getItem("UserData")).Pnr_Details);
// this.currentUserSubscription = this.authenticationService.currentUser.subscribe(user => {
// this.currentUser = user;
// this.router.navigate(['/home']);
// });
this.router.navigate(['/home']);
});
} else {
this.loading = false;
this.alertService.error('Booking Failed. Please try again!', true);
......
......@@ -54,8 +54,13 @@ export class RegisterComponent implements OnInit {
.subscribe(
(data: HttpResponse<any>) => {
console.log("registration-",data.body.Fqtv);
this.alertService.success('Registration successful. Your FQTV number is ' + '"'+ data.body.Fqtv + '"'+ '.' + ' You can use this for your future reference.',true);
this.router.navigate(['/login']);
if (data.body.Fqtv){
this.alertService.success('Dear Customer, your registration is successful. Your Frequent Flyer Number is ' + '"'+ data.body.Fqtv + '"'+ '.' + ' Please use it for subsequent log-in.',true);
this.router.navigate(['/login']);
}else{
this.alertService.error('Registraton failed, please try again with correct value!');
this.loading = false;
}
},
error => {
this.alertService.error(error);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment