1
0
mirror of https://github.com/bitwarden/web synced 2025-12-10 21:33:16 +00:00

Added manual routing

This commit is contained in:
Justin Baur
2021-10-27 11:44:00 -04:00
parent 1403ecfa6f
commit a970ba78ff
7 changed files with 79 additions and 32 deletions

View 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 });
}
}