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

View File

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

View File

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