allow reloading of current tab

This commit is contained in:
Kyle Spearrin 2019-08-19 09:17:40 -04:00
parent aa0bfd3b45
commit 05684b3b03
2 changed files with 16 additions and 8 deletions

View File

@ -219,6 +219,7 @@ const routes: Routes = [
component: CurrentTabComponent,
canActivate: [AuthGuardService],
data: { state: 'tabs_current' },
runGuardsAndResolvers: 'always',
},
{
path: 'vault',
@ -265,6 +266,7 @@ export class NoRouteReuseStrategy implements RouteReuseStrategy {
@NgModule({
imports: [RouterModule.forRoot(routes, {
useHash: true,
onSameUrlNavigation: 'reload',
/*enableTracing: true,*/
})],
exports: [RouterModule],

View File

@ -8,9 +8,12 @@ import {
import {
ActivatedRoute,
NavigationEnd,
Router,
} from '@angular/router';
import { Subscription } from 'rxjs';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
@ -61,6 +64,7 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
private totpTimeout: number;
private loadedTimeout: number;
private searchTimeout: number;
private navSubscription: Subscription;
constructor(private platformUtilsService: PlatformUtilsService, private cipherService: CipherService,
private popupUtilsService: PopupUtilsService, private autofillService: AutofillService,
@ -68,25 +72,27 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
private i18nService: I18nService, private router: Router,
private ngZone: NgZone, private broadcasterService: BroadcasterService,
private changeDetectorRef: ChangeDetectorRef, private syncService: SyncService,
private searchService: SearchService, private storageService: StorageService,
route: ActivatedRoute) {
route.params.subscribe((val) => {
console.log('route.params.subscribe');
if (platformUtilsService.getDevice() === DeviceType.SafariExtension) {
console.log(val);
this.init();
private searchService: SearchService, private storageService: StorageService) {
this.navSubscription = this.router.events.subscribe(async (e: any) => {
// If it is a NavigationEnd event re-initialize the component
if (e instanceof NavigationEnd) {
console.log('nav end');
console.log(e);
await this.init();
}
});
}
async ngOnInit() {
console.log('ngOnInit');
await this.init();
}
ngOnDestroy() {
window.clearTimeout(this.loadedTimeout);
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
if (this.navSubscription != null) {
this.navSubscription.unsubscribe();
}
}
async refresh() {