control back button
This commit is contained in:
parent
258f253a14
commit
885c95e63b
@ -29,7 +29,7 @@ export class AuthGuard implements CanActivate {
|
||||
return this.authService.getAuth().then(response => {
|
||||
return true;
|
||||
}).catch(function (error) {
|
||||
return that.router.parseUrl('/unavailable?target=' + state.url);
|
||||
return that.router.navigateByUrl(that.router.parseUrl('/unavailable?target=' + next.url), { skipLocationChange: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -44,7 +44,7 @@ export class AuthenticatedGuard implements CanActivate {
|
||||
const that = this;
|
||||
return this.authService.getAuth().then((data: any) => {
|
||||
if (!data.authenticated) {
|
||||
return that.router.parseUrl('/login?target=' + state.url);
|
||||
return that.router.navigateByUrl(that.router.parseUrl('/login?target=' + state.url), { skipLocationChange: true, replaceUrl: true });
|
||||
}
|
||||
|
||||
this.profileService.get([ "locale", "darkTheme" ]).subscribe((profileFields: any) => {
|
||||
@ -74,7 +74,7 @@ export class AuthenticatedGuard implements CanActivate {
|
||||
|
||||
return true;
|
||||
}).catch(function (error) {
|
||||
return that.router.parseUrl('/unavailable?target=' + state.url);
|
||||
return that.router.navigateByUrl(that.router.parseUrl('/unavailable?target=' + next.url), { skipLocationChange: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -94,7 +94,7 @@ export class AnonymousGuard implements CanActivate {
|
||||
}
|
||||
return true;
|
||||
}).catch(function (error) {
|
||||
return that.router.parseUrl('/unavailable?target=' + state.url);
|
||||
return that.router.navigateByUrl(that.router.parseUrl('/unavailable?target=' + next.url), { replaceUrl: true });
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -23,11 +23,11 @@ export class FormLoginComponent implements OnInit {
|
||||
this.route.queryParams.subscribe(params => {
|
||||
if (params[ 'target' ]) {
|
||||
this.targetRoute = params[ 'target' ];
|
||||
this.router.navigate([], {queryParams: {target: null}, queryParamsHandling: 'merge'});
|
||||
this.router.navigate([], { queryParams: { target: null }, queryParamsHandling: 'merge', replaceUrl: true });
|
||||
}
|
||||
if (params[ 'error' ] || params[ 'error' ] == '') {
|
||||
this.loginInvalid = true;
|
||||
this.router.navigate([], {queryParams: {error: null}, queryParamsHandling: 'merge'});
|
||||
this.router.navigate([], { queryParams: { error: null }, queryParamsHandling: 'merge', replaceUrl: true });
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -19,7 +19,7 @@ export class UnavailableComponent implements OnInit {
|
||||
this.route.queryParams.subscribe(params => {
|
||||
if (params[ 'target' ]) {
|
||||
this.targetRoute = params[ 'target' ];
|
||||
this.router.navigate([], {queryParams: {target: null}, queryParamsHandling: 'merge'});
|
||||
this.router.navigate([], { queryParams: { target: null }, queryParamsHandling: 'merge', skipLocationChange: true });
|
||||
}
|
||||
});
|
||||
|
||||
@ -29,7 +29,7 @@ export class UnavailableComponent implements OnInit {
|
||||
if (!this.targetRoute || this.targetRoute === "unavailable" || this.targetRoute === "/unavailable") {
|
||||
this.location.back;
|
||||
} else {
|
||||
this.router.navigate([this.targetRoute]);
|
||||
this.router.navigate([ this.targetRoute ], { skipLocationChange: true });
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user