|
@@ -27,9 +27,10 @@ const hideNotification = () => {
|
|
|
*
|
|
|
*/
|
|
|
const notificationVisibilityReducer = createReducer(false, {
|
|
|
+ 'SHOW_NOTIFICATION': showNotification,
|
|
|
+ 'HIDE_NOTIFICATION': hideNotification,
|
|
|
'LOGIN_FAILURE': showNotification,
|
|
|
'CHECK_TOKEN_FAILURE': hideNotification,
|
|
|
- 'HIDE_NOTIFICATION': hideNotification,
|
|
|
'REQUEST_KO': showNotification
|
|
|
})
|
|
|
|
|
@@ -39,6 +40,10 @@ const notificationVisibilityReducer = createReducer(false, {
|
|
|
* @param {*} action
|
|
|
*/
|
|
|
const setNotificationMessage = (message, action) => {
|
|
|
+ if (action.type === 'SHOW_NOTIFICATION') {
|
|
|
+ return action.payload.message
|
|
|
+ }
|
|
|
+
|
|
|
if (action.type === 'LOGIN_FAILURE') {
|
|
|
return 'Fallo al autenticar el usuario'
|
|
|
}
|
|
@@ -48,7 +53,7 @@ const setNotificationMessage = (message, action) => {
|
|
|
}
|
|
|
|
|
|
if (action.type === 'REQUEST_KO' && action.payload !== 401) {
|
|
|
- return 'No se pudo procesar su petición, intente nuevamente'
|
|
|
+ return 'No se pudo procesar su petición'
|
|
|
}
|
|
|
|
|
|
return null
|
|
@@ -58,9 +63,10 @@ const setNotificationMessage = (message, action) => {
|
|
|
*
|
|
|
*/
|
|
|
const notificationMessageReducer = createReducer(null, {
|
|
|
+ 'SHOW_NOTIFICATION': setNotificationMessage,
|
|
|
+ 'HIDE_NOTIFICATION': setNotificationMessage,
|
|
|
'LOGIN_FAILURE': setNotificationMessage,
|
|
|
'CHECK_TOKEN_FAILURE': setNotificationMessage,
|
|
|
- 'HIDE_NOTIFICATION': setNotificationMessage,
|
|
|
'REQUEST_KO': setNotificationMessage
|
|
|
})
|
|
|
|