mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33: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 { isNotEmpty } from '../empty.util';
|
||||||
import { fadeOut } from '../animations/fade';
|
import { fadeOut } from '../animations/fade';
|
||||||
import { AuthService } from '../../core/auth/auth.service';
|
import { AuthService } from '../../core/auth/auth.service';
|
||||||
|
import {Router} from '@angular/router';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* /users/sign-in
|
* /users/sign-in
|
||||||
@@ -90,6 +91,7 @@ export class LogInComponent implements OnDestroy, OnInit {
|
|||||||
constructor(
|
constructor(
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
|
private router: Router,
|
||||||
private store: Store<CoreState>
|
private store: Store<CoreState>
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
@@ -182,6 +184,9 @@ export class LogInComponent implements OnDestroy, OnInit {
|
|||||||
email.trim();
|
email.trim();
|
||||||
password.trim();
|
password.trim();
|
||||||
|
|
||||||
|
// add the current url to store for later redirect.
|
||||||
|
this.authService.setRedirectUrl(this.router.url);
|
||||||
|
|
||||||
// dispatch AuthenticationAction
|
// dispatch AuthenticationAction
|
||||||
this.store.dispatch(new AuthenticateAction(email, password));
|
this.store.dispatch(new AuthenticateAction(email, password));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user