From 6bce723c882b5621bf364e44abc34d9f4288d31c Mon Sep 17 00:00:00 2001 From: wiadev Date: Thu, 24 Aug 2017 14:12:42 +0200 Subject: [PATCH] Error notification gets recreated when navigating after failed process start #1150 --- src/actions/AppActions.js | 6 ++++++ src/actions/WindowActions.js | 3 +++ src/constants/ActionTypes.js | 1 + src/reducers/appHandler.js | 5 +++++ src/routes.js | 6 +++++- 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/actions/AppActions.js b/src/actions/AppActions.js index 14acce84a..1ac47ef65 100644 --- a/src/actions/AppActions.js +++ b/src/actions/AppActions.js @@ -322,6 +322,12 @@ export function deleteNotification(key){ } } +export function clearNotifications() { + return { + type: types.CLEAR_NOTIFICATIONS, + } +} + export function updateUri(pathname, query, prop, value) { return (dispatch) => { let url = pathname + '?'; diff --git a/src/actions/WindowActions.js b/src/actions/WindowActions.js index d4a7c70eb..75ed6d05c 100644 --- a/src/actions/WindowActions.js +++ b/src/actions/WindowActions.js @@ -646,7 +646,10 @@ export function createProcess(processType, viewId, type, ids, tabId, rowId) { startProcess(processType, pid).then(response => { dispatch(handleProcessResponse(response, processType, pid)); }).catch(err => { + dispatch(closeModal()); + dispatch(setProcessSaved()); + throw err; }); } diff --git a/src/constants/ActionTypes.js b/src/constants/ActionTypes.js index d298d584e..5b879acc3 100644 --- a/src/constants/ActionTypes.js +++ b/src/constants/ActionTypes.js @@ -37,6 +37,7 @@ export const CHANGE_INDICATOR_STATE = 'CHANGE_INDICATOR_STATE'; export const ADD_NOTIFICATION = 'ADD_NOTIFICATION'; export const SET_NOTIFICATION_PROGRESS = 'SET_NOTIFICATION_PROGRESS'; export const DELETE_NOTIFICATION = 'DELETE_NOTIFICATION'; +export const CLEAR_NOTIFICATIONS = 'CLEAR_NOTIFICATIONS'; // END OF NOTIFICATION ACTIONS //AUTH ACTIONS diff --git a/src/reducers/appHandler.js b/src/reducers/appHandler.js index ed4693be4..d0ad62c1b 100644 --- a/src/reducers/appHandler.js +++ b/src/reducers/appHandler.js @@ -70,6 +70,11 @@ export default function appHandler(state = initialState, action) { }, {}) }); + case types.CLEAR_NOTIFICATIONS: + return Object.assign({}, state, { + notifications: {} + }); + // END OF NOTIFICATION ACTIONS case types.GET_NOTIFICATIONS_SUCCESS: return Object.assign({}, state, { diff --git a/src/routes.js b/src/routes.js index e0459e089..11dcf966d 100644 --- a/src/routes.js +++ b/src/routes.js @@ -14,7 +14,8 @@ import { logoutRequest, logoutSuccess, loginSuccess, - localLoginRequest + localLoginRequest, + clearNotifications } from './actions/AppActions'; import { @@ -35,7 +36,10 @@ export const getRoutes = (store, auth) => { } }) }else{ + store.dispatch(clearNotifications()); + store.dispatch(loginSuccess(auth)); + callback(); } }