Modified the log-in component to set the redirectUrl in AuthState (so the user is returned to the same page after login).

This commit is contained in:
Michael W Spalti
2019-08-28 11:02:05 -07:00
parent 80706b9f61
commit 6360d5a88c

View File

@@ -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<CoreState>
) {
}
@@ -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));