1
0
mirror of https://github.com/bitwarden/web synced 2025-12-13 14:53:25 +00: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

Submodule jslib updated: 3362334d2c...2b575f0c60

View File

@@ -36,9 +36,12 @@ export class LockComponent extends BaseLockComponent {
this.router.navigate(['vault']); this.router.navigate(['vault']);
} }
const previousUrl = this.routerService.getPreviousUrl(); this.onSuccessfulSubmit = () => {
if (previousUrl !== '/' && previousUrl.indexOf('lock') === -1) { const previousUrl = this.routerService.getPreviousUrl();
this.successRoute = previousUrl; 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.notificationsService.updateConnection(false);
this.router.navigate(['lock']); this.router.navigate(['lock']);
break; break;
case 'lockedUrl':
window.setTimeout(() => this.routerService.setPreviousUrl(message.url), 500);
break;
case 'syncStarted': case 'syncStarted':
break; break;
case 'syncCompleted': case 'syncCompleted':

View File

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