mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Added action to insert authentication message
This commit is contained in:
@@ -22,6 +22,7 @@ export const AuthActionTypes = {
|
|||||||
REFRESH_TOKEN: type('dspace/auth/REFRESH_TOKEN'),
|
REFRESH_TOKEN: type('dspace/auth/REFRESH_TOKEN'),
|
||||||
REFRESH_TOKEN_SUCCESS: type('dspace/auth/REFRESH_TOKEN_SUCCESS'),
|
REFRESH_TOKEN_SUCCESS: type('dspace/auth/REFRESH_TOKEN_SUCCESS'),
|
||||||
REFRESH_TOKEN_ERROR: type('dspace/auth/REFRESH_TOKEN_ERROR'),
|
REFRESH_TOKEN_ERROR: type('dspace/auth/REFRESH_TOKEN_ERROR'),
|
||||||
|
ADD_MESSAGE: type('dspace/auth/ADD_MESSAGE'),
|
||||||
RESET_MESSAGES: type('dspace/auth/RESET_MESSAGES'),
|
RESET_MESSAGES: type('dspace/auth/RESET_MESSAGES'),
|
||||||
LOG_OUT: type('dspace/auth/LOG_OUT'),
|
LOG_OUT: type('dspace/auth/LOG_OUT'),
|
||||||
LOG_OUT_ERROR: type('dspace/auth/LOG_OUT_ERROR'),
|
LOG_OUT_ERROR: type('dspace/auth/LOG_OUT_ERROR'),
|
||||||
@@ -283,6 +284,20 @@ export class RegistrationSuccessAction implements Action {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add uthentication message.
|
||||||
|
* @class AddAuthenticationMessageAction
|
||||||
|
* @implements {Action}
|
||||||
|
*/
|
||||||
|
export class AddAuthenticationMessageAction implements Action {
|
||||||
|
public type: string = AuthActionTypes.ADD_MESSAGE;
|
||||||
|
payload: string;
|
||||||
|
|
||||||
|
constructor(message: string) {
|
||||||
|
this.payload = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset error.
|
* Reset error.
|
||||||
* @class ResetAuthenticationMessagesAction
|
* @class ResetAuthenticationMessagesAction
|
||||||
@@ -326,4 +341,6 @@ export type AuthActions
|
|||||||
| RedirectWhenTokenExpiredAction
|
| RedirectWhenTokenExpiredAction
|
||||||
| RegistrationAction
|
| RegistrationAction
|
||||||
| RegistrationErrorAction
|
| RegistrationErrorAction
|
||||||
| RegistrationSuccessAction;
|
| RegistrationSuccessAction
|
||||||
|
| AddAuthenticationMessageAction
|
||||||
|
| ResetAuthenticationMessagesAction;
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
// import actions
|
// import actions
|
||||||
import {
|
import {
|
||||||
|
AddAuthenticationMessageAction,
|
||||||
AuthActions, AuthActionTypes, AuthenticatedSuccessAction, AuthenticationErrorAction,
|
AuthActions, AuthActionTypes, AuthenticatedSuccessAction, AuthenticationErrorAction,
|
||||||
AuthenticationSuccessAction, LogOutErrorAction, RedirectWhenAuthenticationIsRequiredAction,
|
AuthenticationSuccessAction, LogOutErrorAction, RedirectWhenAuthenticationIsRequiredAction,
|
||||||
RedirectWhenTokenExpiredAction, SetRedirectUrlAction
|
RedirectWhenTokenExpiredAction, SetRedirectUrlAction
|
||||||
@@ -153,6 +154,11 @@ export function authReducer(state: any = initialState, action: AuthActions): Aut
|
|||||||
refreshing: false,
|
refreshing: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
case AuthActionTypes.ADD_MESSAGE:
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
info: (action as AddAuthenticationMessageAction).payload,
|
||||||
|
});
|
||||||
|
|
||||||
case AuthActionTypes.RESET_MESSAGES:
|
case AuthActionTypes.RESET_MESSAGES:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
authenticated: state.authenticated,
|
authenticated: state.authenticated,
|
||||||
|
Reference in New Issue
Block a user