mirror of
https://github.com/google/nomulus.git
synced 2025-07-24 03:30:46 +02:00
Fix console nextUrl stacking routes (#2164)
This commit is contained in:
parent
1eed9c82dc
commit
2dc87d42b4
1 changed files with 13 additions and 6 deletions
|
@ -13,7 +13,11 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import {
|
||||||
|
ActivatedRouteSnapshot,
|
||||||
|
Router,
|
||||||
|
RouterStateSnapshot,
|
||||||
|
} from '@angular/router';
|
||||||
|
|
||||||
import { RegistrarService } from './registrar.service';
|
import { RegistrarService } from './registrar.service';
|
||||||
|
|
||||||
|
@ -26,13 +30,16 @@ export class RegistrarGuard {
|
||||||
private registrarService: RegistrarService
|
private registrarService: RegistrarService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
canActivate(): Promise<boolean> | boolean {
|
canActivate(
|
||||||
|
_: ActivatedRouteSnapshot,
|
||||||
|
state: RouterStateSnapshot
|
||||||
|
): Promise<boolean> | boolean {
|
||||||
if (this.registrarService.activeRegistrarId) {
|
if (this.registrarService.activeRegistrarId) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Get the full URL including any nested children (skip the initial '#/')
|
return this.router.navigate([
|
||||||
// NB: an empty nextUrl takes the user to the home page
|
`/empty-registrar`,
|
||||||
const nextUrl = location.hash.split('#/')[1] || '';
|
{ nextUrl: state.url || '' },
|
||||||
return this.router.navigate([`/empty-registrar`, { nextUrl }]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue