import { Component, OnInit, Inject } from '@angular/core'; import { Router, ActivatedRoute, Params } from '@angular/router'; import { BlockUI, NgBlockUI } from 'ng-block-ui'; import { AuthService } from '../../auth/auth.service'; import { RouteHandleService } from '../RouteHandle.service'; @Component({ selector: 'app-auth-callback', templateUrl: './auth-callback.component.html', styleUrls: ['./auth-callback.component.css'] }) export class AuthCallbackComponent implements OnInit { @BlockUI() blockUI: NgBlockUI; baseu: string; umUrl: string; constructor(@Inject('BASE_URL') baseUrl: string, private authService: AuthService, public router: Router, public routehandleservice: RouteHandleService, @Inject('UM_URL') Um_Url: string) { this.baseu = baseUrl; this.umUrl = Um_Url; } ngOnInit() { if (this.routehandleservice.isRedirectDetailsExist()) { this.routehandleservice.showblockUi(); } else { this.blockUI.start('Redirecting to Main Page'); } console.log('AuthCallbackComponent start'); this.authService.completeAuthentication().then(s => { if (this.authService.isLoggedIn() === true) { if (this.authService.isPasswordExpired()) { location.assign(this.umUrl + '#/change-password?msg=PasswordExpire'); } // if (!this.routehandleservice.isUrlExist()) { // location.assign(this.baseu + '/'); // } // const redirectDetails = this.routehandleservice.getRedirectDetails(0); // if (redirectDetails !== null) { // console.log('redirect call back'); // // this.routehandleservice.showblockUi(); // this.authService.ResetFlag(); // this.authService.isRedirect = true; // location.assign(redirectDetails.fullUrl); // } else { this.blockUI.stop(); this.router.navigate(['']); // } // this.authService.load(); // location.reload(); // this.router.navigateByUrl('/'); } } ); } }