mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-14 01:45:12 +00:00
* new console * move npm ci to angular build * rel path for assets * local grpc copy * login policy, rm clear views, features rel path * lock Co-authored-by: Livio Amstutz <[email protected]>
33 lines
764 B
TypeScript
33 lines
764 B
TypeScript
import { Location } from '@angular/common';
|
|
import { Injectable } from '@angular/core';
|
|
import { NavigationEnd, Router } from '@angular/router';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class NavigationService {
|
|
private history: string[] = [];
|
|
|
|
constructor(private router: Router, private location: Location) {
|
|
this.router.events.subscribe((event) => {
|
|
if (event instanceof NavigationEnd) {
|
|
this.history.push(event.urlAfterRedirects);
|
|
}
|
|
});
|
|
}
|
|
|
|
public back(): void {
|
|
if (this.isBackPossible) {
|
|
this.location.back();
|
|
this.history.pop();
|
|
} else {
|
|
this.router.navigateByUrl('/');
|
|
this.history.pop();
|
|
}
|
|
}
|
|
|
|
public get isBackPossible(): boolean {
|
|
return this.history.length > 1;
|
|
}
|
|
}
|