mirror of
https://github.com/bitwarden/web
synced 2025-12-10 21:33:16 +00:00
Added manual routing
This commit is contained in:
28
src/app/organizations/tools/tools-router.component.ts
Normal file
28
src/app/organizations/tools/tools-router.component.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import {
|
||||
Component,
|
||||
OnInit,
|
||||
} from '@angular/core';
|
||||
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-tools-router',
|
||||
templateUrl: 'tools-router.component.html',
|
||||
})
|
||||
export class ToolsRouterComponent implements OnInit {
|
||||
constructor(private route: ActivatedRoute, private router: Router,
|
||||
private userService: UserService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.params.subscribe(async params => {
|
||||
console.log('Routing...');
|
||||
const org = await this.userService.getOrganization(params.organizationId);
|
||||
this.routeTo(org.canAccessImportExport ? 'import' : 'exposed-passwords-report');
|
||||
});
|
||||
}
|
||||
|
||||
routeTo(page: string) {
|
||||
this.router.navigate([page], { relativeTo: this.route });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user