mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Added action to retrieve authenticated eperson object
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
// import @ngrx
|
||||
import { Action } from '@ngrx/store';
|
||||
|
||||
// import type function
|
||||
import { type } from '../../shared/ngrx/type';
|
||||
|
||||
// import models
|
||||
import { EPerson } from '../eperson/models/eperson.model';
|
||||
import { AuthTokenInfo } from './models/auth-token-info.model';
|
||||
@@ -31,6 +29,9 @@ export const AuthActionTypes = {
|
||||
REGISTRATION_ERROR: type('dspace/auth/REGISTRATION_ERROR'),
|
||||
REGISTRATION_SUCCESS: type('dspace/auth/REGISTRATION_SUCCESS'),
|
||||
SET_REDIRECT_URL: type('dspace/auth/SET_REDIRECT_URL'),
|
||||
RETRIEVE_AUTHENTICATED_EPERSON: type('dspace/auth/RETRIEVE_AUTHENTICATED_EPERSON'),
|
||||
RETRIEVE_AUTHENTICATED_EPERSON_SUCCESS: type('dspace/auth/RETRIEVE_AUTHENTICATED_EPERSON_SUCCESS'),
|
||||
RETRIEVE_AUTHENTICATED_EPERSON_ERROR: type('dspace/auth/RETRIEVE_AUTHENTICATED_EPERSON_ERROR'),
|
||||
};
|
||||
|
||||
/* tslint:disable:max-classes-per-file */
|
||||
@@ -76,11 +77,11 @@ export class AuthenticatedSuccessAction implements Action {
|
||||
payload: {
|
||||
authenticated: boolean;
|
||||
authToken: AuthTokenInfo;
|
||||
user: EPerson
|
||||
userHref: string
|
||||
};
|
||||
|
||||
constructor(authenticated: boolean, authToken: AuthTokenInfo, user: EPerson) {
|
||||
this.payload = { authenticated, authToken, user };
|
||||
constructor(authenticated: boolean, authToken: AuthTokenInfo, userHref: string) {
|
||||
this.payload = { authenticated, authToken, userHref };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,6 +323,47 @@ export class SetRedirectUrlAction implements Action {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the authenticated eperson.
|
||||
* @class RetrieveAuthenticatedEpersonAction
|
||||
* @implements {Action}
|
||||
*/
|
||||
export class RetrieveAuthenticatedEpersonAction implements Action {
|
||||
public type: string = AuthActionTypes.RETRIEVE_AUTHENTICATED_EPERSON;
|
||||
payload: string;
|
||||
|
||||
constructor(user: string) {
|
||||
this.payload = user ;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the authenticated eperson in the state.
|
||||
* @class RetrieveAuthenticatedEpersonSuccessAction
|
||||
* @implements {Action}
|
||||
*/
|
||||
export class RetrieveAuthenticatedEpersonSuccessAction implements Action {
|
||||
public type: string = AuthActionTypes.RETRIEVE_AUTHENTICATED_EPERSON_SUCCESS;
|
||||
payload: EPerson;
|
||||
|
||||
constructor(user: EPerson) {
|
||||
this.payload = user ;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the authenticated eperson in the state.
|
||||
* @class RetrieveAuthenticatedEpersonSuccessAction
|
||||
* @implements {Action}
|
||||
*/
|
||||
export class RetrieveAuthenticatedEpersonErrorAction implements Action {
|
||||
public type: string = AuthActionTypes.RETRIEVE_AUTHENTICATED_EPERSON_ERROR;
|
||||
payload: Error;
|
||||
|
||||
constructor(payload: Error) {
|
||||
this.payload = payload ;
|
||||
}
|
||||
}
|
||||
/* tslint:enable:max-classes-per-file */
|
||||
|
||||
/**
|
||||
@@ -343,4 +385,8 @@ export type AuthActions
|
||||
| RegistrationErrorAction
|
||||
| RegistrationSuccessAction
|
||||
| AddAuthenticationMessageAction
|
||||
| ResetAuthenticationMessagesAction;
|
||||
| ResetAuthenticationMessagesAction
|
||||
| RetrieveAuthenticatedEpersonAction
|
||||
| RetrieveAuthenticatedEpersonErrorAction
|
||||
| RetrieveAuthenticatedEpersonSuccessAction
|
||||
| SetRedirectUrlAction;
|
||||
|
Reference in New Issue
Block a user