1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-08-26 23:09:46 +02:00

go back to previous url after lock

This commit is contained in:
Kyle Spearrin 2019-02-22 13:17:10 -05:00
parent ec3e438c99
commit 12e2bcbbd9
4 changed files with 16 additions and 6 deletions

2
jslib

@ -1 +1 @@
Subproject commit 3362334d2ce2220fb0d1af322d88c9efec37763d
Subproject commit 2b575f0c6064df6e4d8ad5ed4c76f084fcb3a898

View File

@ -36,9 +36,12 @@ export class LockComponent extends BaseLockComponent {
this.router.navigate(['vault']);
}
const previousUrl = this.routerService.getPreviousUrl();
if (previousUrl !== '/' && previousUrl.indexOf('lock') === -1) {
this.successRoute = previousUrl;
}
this.onSuccessfulSubmit = () => {
const previousUrl = this.routerService.getPreviousUrl();
if (previousUrl !== '/' && previousUrl.indexOf('lock') === -1) {
this.successRoute = previousUrl;
}
this.router.navigate([this.successRoute]);
};
}
}

View File

@ -111,6 +111,9 @@ export class AppComponent implements OnDestroy, OnInit {
this.notificationsService.updateConnection(false);
this.router.navigate(['lock']);
break;
case 'lockedUrl':
window.setTimeout(() => this.routerService.setPreviousUrl(message.url), 500);
break;
case 'syncStarted':
break;
case 'syncCompleted':

View File

@ -14,7 +14,7 @@ export class RouterService {
private currentUrl: string = undefined;
constructor(private router: Router, private activatedRoute: ActivatedRoute,
private titleService: Title, private i18nService: I18nService) {
private titleService: Title, i18nService: I18nService) {
this.currentUrl = this.router.url;
router.events.subscribe((event) => {
if (event instanceof NavigationEnd) {
@ -55,4 +55,8 @@ export class RouterService {
getPreviousUrl() {
return this.previousUrl;
}
setPreviousUrl(url: string) {
this.previousUrl = url;
}
}