mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 23:13:04 +00:00
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:
@@ -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));
|
||||
|
||||
|
Reference in New Issue
Block a user