Skip to content

Commit

Permalink
Merge pull request #265 from KleeGroup/fix-#264-confirm-props
Browse files Browse the repository at this point in the history
[confirm] Add props to the confirmWrapper
  • Loading branch information
pierr committed Dec 14, 2015
2 parents 42c2070 + 108f756 commit 8c190fd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/application/confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,24 @@ 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){
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);
}
},
...props
}
},
type: 'update'
Expand Down

0 comments on commit 8c190fd

Please sign in to comment.