+
+ // Track previous url
+ this.currentUrl = this.router.url
+ router.events.subscribe(event => {
+ if (event instanceof NavigationEnd) {
+ this.previousUrl = this.currentUrl
+ this.currentUrl = event.url
+ }
+ })
+ }
+
+ redirectToPreviousRoute () {
+ if (this.previousUrl) return this.router.navigateByUrl(this.previousUrl)
+
+ return this.redirectToHomepage()