From 0d135e7b094cd696d2933a27dbab9b71b739205f Mon Sep 17 00:00:00 2001 From: Stan Date: Mon, 14 Dec 2015 14:57:00 +0100 Subject: [PATCH 1/2] [confirm] Fix #264 --- src/application/confirm.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/application/confirm.js b/src/application/confirm.js index 3e86d47..b951143 100644 --- a/src/application/confirm.js +++ b/src/application/confirm.js @@ -5,20 +5,21 @@ import {handleViewAction as dispatch} from '../dispatcher'; * @param {string | numver | component} ContentComponent - The component to display in the conform message. * @return {Promise}Confirm is a promise in order to be able to provide success and error callbacks. */ -export default function confirm(ContentComponent){ +export default function confirm(ContentComponent, props) { return new Promise((resolve, reject) => { dispatch({ data: { - confirmConfig:{ + confirmConfig: { isVisible: true, Content: ContentComponent, - handleCancel(err){ + contentProps: props, + handleCancel(err) { dispatch({data: {confirmConfig: {isVsible: false, Content: null}}, type: 'update'}); //Maybe there is a little async problem. // We could listen to the store once on the change it is time to call resolve. reject(err); }, - handleConfirm(data){ + handleConfirm(data) { dispatch({data: {confirmConfig: {isVsible: false, Content: null}}, type: 'update'}); resolve(data); } From 108f7566a14938fdd87f13a39482d203bc889053 Mon Sep 17 00:00:00 2001 From: Stan Date: Mon, 14 Dec 2015 15:12:21 +0100 Subject: [PATCH 2/2] [confirm] Flatten provided props --- src/application/confirm.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/application/confirm.js b/src/application/confirm.js index b951143..d0427e1 100644 --- a/src/application/confirm.js +++ b/src/application/confirm.js @@ -12,7 +12,6 @@ export default function confirm(ContentComponent, props) { confirmConfig: { isVisible: true, Content: ContentComponent, - contentProps: props, handleCancel(err) { dispatch({data: {confirmConfig: {isVsible: false, Content: null}}, type: 'update'}); //Maybe there is a little async problem. @@ -22,7 +21,8 @@ export default function confirm(ContentComponent, props) { handleConfirm(data) { dispatch({data: {confirmConfig: {isVsible: false, Content: null}}, type: 'update'}); resolve(data); - } + }, + ...props } }, type: 'update'