Files
we_bstly-web/src/app/pages/unavailable/unavailable.component.ts
T
2022-01-21 22:38:31 +01:00

39 lines
985 B
TypeScript

import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common'
import { Router, ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-unavailable',
templateUrl: './unavailable.component.html'
})
export class UnavailableComponent implements OnInit {
targetRoute = '';
constructor(
private location: Location,
private router: Router,
private route: ActivatedRoute) { }
ngOnInit(): void {
this.route.queryParams.subscribe({
next: (params) => {
if (params[ 'target' ]) {
this.targetRoute = params[ 'target' ];
this.router.navigate([], { queryParams: { target: null }, queryParamsHandling: 'merge', skipLocationChange: true });
}
}
});
}
retry() {
if (!this.targetRoute || this.targetRoute === "unavailable" || this.targetRoute === "/unavailable") {
this.location.back;
} else {
this.router.navigate([ this.targetRoute ]);
}
}
}