From f63065eace1e80e992d24257a30952fc03a3c30f Mon Sep 17 00:00:00 2001 From: surya Date: Sat, 9 Apr 2022 12:37:22 +0530 Subject: [PATCH] Roting issue --- .../src/app/session/login/login.component.ts | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/ng6-seed/src/app/session/login/login.component.ts b/ng6-seed/src/app/session/login/login.component.ts index 0a3f049..5d2cf51 100755 --- a/ng6-seed/src/app/session/login/login.component.ts +++ b/ng6-seed/src/app/session/login/login.component.ts @@ -17,6 +17,7 @@ import { DashboardService } from 'app/dashboard/dashboard.service'; import { LoaderService } from 'app/shared/loaderService/loader.service'; import { OtpComponent } from '../otp/otp.component'; + @Component({ selector: 'ms-login-session', templateUrl: './login-component.html', @@ -78,8 +79,26 @@ export class LoginComponent implements OnInit{ this.getCommonSettings(); // local storage for validate user access localStorage.setItem('user_role',res.idToken.payload["custom:role_id"]); + console.log(res.idToken.payload ["custom:role_id"]); + // alert(localStorage.getItem('user_role')) + if(res.idToken.payload["custom:role_id"]=='10' || res.idToken.payload["custom:role_id"]=='11' || res.idToken.payload["custom:role_id"]=='13' || res.idToken.payload["custom:role_id"]=='15' || res.idToken.payload["custom:role_id"]=='17' || res.idToken.payload["custom:role_id"]=='19') + { + // this.router.navigate(['sales-pd-list/list-pd']); + this.router.navigate(['/sales-pd-list']); + } + else + { + + alert('Sales User Roles only allowed'); + this.aws.logout().subscribe(res=>{ + //alert("res"); + this.router.navigate(['/authentication/login']); + }) + + // this.router.navigate(['personal_discussion/pdlist']); + } //this.router.navigate(['/']); - this.router.navigate(['/sales-pd-list']); + // this.router.navigate(['/sales-pd-list']); } this.loaderService.closeMatSpinnerDialog(); }, err => {