Fixed an issue with redirect url

This commit is contained in:
Giuseppe Digilio
2018-05-08 10:34:46 +02:00
parent 2c938571b3
commit b0b4342f24
3 changed files with 4 additions and 7 deletions

View File

@@ -54,13 +54,13 @@ export class AuthService {
// If current route is different from the one setted in authentication guard
// and is not the login route, clear redirect url and messages
const routeUrlObs = this.store.select(routerStateSelector)
const routeUrl$ = this.store.select(routerStateSelector)
.filter((routerState: RouterReducerState) => isNotUndefined(routerState) && isNotUndefined(routerState.state))
.filter((routerState: RouterReducerState) => !this.isLoginRoute(routerState.state.url))
.map((routerState: RouterReducerState) => routerState.state.url);
const redirectUrlObs = this.getRedirectUrl();
routeUrlObs.pipe(
withLatestFrom(redirectUrlObs),
const redirectUrl$ = this.store.select(getRedirectUrl).distinctUntilChanged();
routeUrl$.pipe(
withLatestFrom(redirectUrl$),
map(([routeUrl, redirectUrl]) => [routeUrl, redirectUrl])
).filter(([routeUrl, redirectUrl]) => isNotEmpty(redirectUrl) && (routeUrl !== redirectUrl))
.subscribe(() => {
@@ -329,7 +329,6 @@ export class AuthService {
this.getRedirectUrl()
.first()
.subscribe((redirectUrl) => {
console.log('Browser');
if (isNotEmpty(redirectUrl)) {
this.clearRedirectUrl();

View File

@@ -58,7 +58,6 @@ export class ServerAuthService extends AuthService {
this.getRedirectUrl()
.first()
.subscribe((redirectUrl) => {
console.log('server side');
if (isNotEmpty(redirectUrl)) {
// override the route reuse strategy
this.router.routeReuseStrategy.shouldReuseRoute = () => {

View File

@@ -14,7 +14,6 @@ export class ServerCookieService extends CookieService implements ICookieService
}
public get(name: string): any {
console.log(this.req.connection.remoteAddress);
try {
return JSON.parse(this.req.cookies[name])
} catch (err) {