Files
we_bstly-web/src/app/pages/unavailable/unavailable.component.ts
T
2025-05-11 18:05:06 +02:00

40 lines
1001 B
TypeScript

import { Location } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
@Component({
standalone: false,
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]);
}
}
}