From 6360d5a88c9d38b128902eb1c7610c93b83760b9 Mon Sep 17 00:00:00 2001 From: Michael W Spalti Date: Wed, 28 Aug 2019 11:02:05 -0700 Subject: [PATCH] Modified the log-in component to set the redirectUrl in AuthState (so the user is returned to the same page after login). --- src/app/shared/log-in/log-in.component.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/shared/log-in/log-in.component.ts b/src/app/shared/log-in/log-in.component.ts index 1291e6aa4c..6bdf7ad987 100644 --- a/src/app/shared/log-in/log-in.component.ts +++ b/src/app/shared/log-in/log-in.component.ts @@ -20,6 +20,7 @@ import { CoreState } from '../../core/core.reducers'; import { isNotEmpty } from '../empty.util'; import { fadeOut } from '../animations/fade'; import { AuthService } from '../../core/auth/auth.service'; +import {Router} from '@angular/router'; /** * /users/sign-in @@ -90,6 +91,7 @@ export class LogInComponent implements OnDestroy, OnInit { constructor( private authService: AuthService, private formBuilder: FormBuilder, + private router: Router, private store: Store ) { } @@ -182,6 +184,9 @@ export class LogInComponent implements OnDestroy, OnInit { email.trim(); password.trim(); + // add the current url to store for later redirect. + this.authService.setRedirectUrl(this.router.url); + // dispatch AuthenticationAction this.store.dispatch(new AuthenticateAction(email, password));