This commit is contained in:
Peter Maquiran
2022-04-06 14:55:14 +01:00
44 changed files with 430 additions and 292 deletions
+20 -8
View File
@@ -44,7 +44,7 @@ export class LoginPage implements OnInit {
private changeProfileService: ChangeProfileService,
public ThemeService: ThemeService,
private storageservice: StorageService,
public permissionService: PermissionService,
public p: PermissionService,
) {}
ngOnInit() {
@@ -104,11 +104,20 @@ export class LoginPage implements OnInit {
// login to API successfully
if (attempt) {
if (attempt.UserId == SessionStore.user.UserId) {
await this.authService.SetSession(attempt, this.userattempt);
await this.authService.loginChat();
await this.authService.loginToChatWs();
console.log(this.p.userPermission(this.permissionList.Chat.access));
if(this.p.userPermission(this.permissionList.Chat.access)){
alert('RC IN')
await this.authService.loginChat();
await this.authService.loginToChatWs();
}
this.getToken();
SessionStore.setInativity(true);
@@ -124,8 +133,11 @@ export class LoginPage implements OnInit {
this.changeProfileService.run();
await this.authService.loginChat();
await this.authService.loginToChatWs();
if(this.p.userPermission(this.permissionList.Chat.access)){
await this.authService.loginChat();
await this.authService.loginToChatWs();
}
this.getToken();
this.router.navigateByUrl('/pin', { replaceUrl: true });
@@ -149,13 +161,13 @@ export class LoginPage implements OnInit {
if(pathName) {
this.router.navigate([pathName]);
} else {
if(this.permissionService.userPermission(this.permissionList.Agenda.access) || this.permissionService.userPermission(this.permissionList.Gabinete.access)){
if(this.p.userPermission(this.permissionList.Agenda.access) || this.p.userPermission(this.permissionList.Gabinete.access)){
this.router.navigate(['/home/events']);
}
else if(this.permissionService.userPermission(this.permissionList.Chat.access) && this.permissionService.userPermission(this.permissionList.Actions.access)){
else if(this.p.userPermission(this.permissionList.Chat.access) && this.p.userPermission(this.permissionList.Actions.access)){
this.router.navigate(['/home/chat']);
}
else if(this.permissionService.userPermission(this.permissionList.Actions.access)){
else if(this.p.userPermission(this.permissionList.Actions.access)){
this.router.navigate(['/home/publications']);
}
}