Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
#628 Refactor of process handling
Browse files Browse the repository at this point in the history
  • Loading branch information
damianprzygodzki committed Apr 12, 2017
1 parent 727b558 commit ccfeba1
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/actions/WindowActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -620,21 +620,30 @@ export function createProcess(processType, viewId, type, ids, tabId, rowId) {
export function handleProcessResponse(response, type, id, successCallback) {
return (dispatch) => {
const {
error, summary, openDocumentId, openDocumentWindowId,
reportFilename, openViewId, openViewWindowId
error, summary, action
} = response.data;

if(error){
dispatch(addNotification('Process error', summary, 5000, 'error'));
}else{
if(openViewId && openViewWindowId){
dispatch(openRawModal(openViewWindowId, openViewId));
}else if(openDocumentWindowId && openDocumentId){
dispatch(push(
'/window/' + openDocumentWindowId + '/' + openDocumentId
));
}else if(reportFilename){
dispatch(openFile('process', type, id, 'print', reportFilename))
if(action){
switch(action.type){
case 'openView':
dispatch(openRawModal(action.windowId, action.viewId));
break;
case 'openReport':
dispatch(openFile(
'process', action.contentType, id, 'print',
action.filename
));
break;
case 'openDocument':
dispatch(push(
'/window/' + action.windowId +
'/' + action.documentId
));
break;
}
}

if(summary){
Expand Down

0 comments on commit ccfeba1

Please sign in to comment.