react-cmf
Advanced tools
Comparing version 0.63.0 to 0.63.1
@@ -112,2 +112,3 @@ 'use strict'; | ||
this.stack = { | ||
response: response, | ||
headers: headers, | ||
@@ -166,6 +167,16 @@ status: response.status, | ||
}, action); | ||
dispatch(httpError(newAction.error)); | ||
if (newAction.onError) { | ||
dispatch(onError(newAction, newAction.error)); | ||
} | ||
// clone the response object else the next call to text or json | ||
// triggers an exception Already use | ||
newAction.error.stack.response.clone().text().then(function (response) { | ||
try { | ||
newAction.error.stack.response = response; | ||
newAction.error.stack.messageObject = JSON.parse(response); | ||
} finally { | ||
dispatch(httpError(newAction.error)); | ||
if (newAction.onError) { | ||
dispatch(onError(newAction, newAction.error)); | ||
} | ||
} | ||
}); | ||
}; | ||
@@ -172,0 +183,0 @@ return fetch(action.url, config).then(status).then(handleResponse).then(function (response) { |
@@ -53,2 +53,11 @@ 'use strict'; | ||
}, | ||
'menu:actionCreator': { | ||
id: 'menu:actionCreator', | ||
actionCreator: 'action-creator', | ||
name: 'Action creator', | ||
icon: 'fa-bars', | ||
payload: { | ||
type: 'TEST_ACTION_CREATOR' | ||
} | ||
}, | ||
'menu:routerReplace': { | ||
@@ -55,0 +64,0 @@ id: 'routerReplace', |
@@ -60,12 +60,3 @@ 'use strict'; | ||
value: function render() { | ||
var _this2 = this; | ||
// FIXME: what is that .onClick ? | ||
var childrenWithProps = _react2.default.Children.map(this.props.children, function (child) { | ||
return _react2.default.cloneElement(child, { | ||
onClick: _this2.onClick | ||
}); | ||
}); | ||
var child = _react2.default.Children.only(childrenWithProps[0]); | ||
return child; | ||
return _react.Children.only(this.props.children); | ||
} | ||
@@ -81,6 +72,6 @@ }]); | ||
RegistryProvider.propTypes = { | ||
children: _react2.default.PropTypes.object | ||
children: _react.PropTypes.element.isRequired | ||
}; | ||
RegistryProvider.childContextTypes = { | ||
registry: _react2.default.PropTypes.object | ||
registry: _react.PropTypes.object | ||
}; |
@@ -90,3 +90,3 @@ { | ||
}, | ||
"version": "0.63.0" | ||
"version": "0.63.1" | ||
} |
@@ -89,2 +89,3 @@ import get from 'lodash/get'; | ||
this.stack = { | ||
response, | ||
headers, | ||
@@ -140,6 +141,16 @@ status: response.status, | ||
}, action); | ||
dispatch(httpError(newAction.error)); | ||
if (newAction.onError) { | ||
dispatch(onError(newAction, newAction.error)); | ||
} | ||
// clone the response object else the next call to text or json | ||
// triggers an exception Already use | ||
newAction.error.stack.response.clone().text().then((response) => { | ||
try { | ||
newAction.error.stack.response = response; | ||
newAction.error.stack.messageObject = JSON.parse(response); | ||
} finally { | ||
dispatch(httpError(newAction.error)); | ||
if (newAction.onError) { | ||
dispatch(onError(newAction, newAction.error)); | ||
} | ||
} | ||
}); | ||
}; | ||
@@ -146,0 +157,0 @@ return fetch(action.url, config) |
@@ -53,2 +53,11 @@ const settings = { | ||
}, | ||
'menu:actionCreator': { | ||
id: 'menu:actionCreator', | ||
actionCreator: 'action-creator', | ||
name: 'Action creator', | ||
icon: 'fa-bars', | ||
payload: { | ||
type: 'TEST_ACTION_CREATOR', | ||
}, | ||
}, | ||
'menu:routerReplace': { | ||
@@ -55,0 +64,0 @@ id: 'routerReplace', |
/** | ||
* @module react-cmf/lib/RegistryProvider | ||
*/ | ||
import React from 'react'; | ||
import React, { Children, PropTypes } from 'react'; | ||
import Registry from './registry'; | ||
@@ -25,11 +25,3 @@ | ||
render() { | ||
// FIXME: what is that .onClick ? | ||
const childrenWithProps = React.Children.map( | ||
this.props.children, | ||
(child) => React.cloneElement(child, { | ||
onClick: this.onClick, | ||
}) | ||
); | ||
const child = React.Children.only(childrenWithProps[0]); | ||
return (child); | ||
return Children.only(this.props.children); | ||
} | ||
@@ -39,6 +31,6 @@ } | ||
RegistryProvider.propTypes = { | ||
children: React.PropTypes.object, | ||
children: PropTypes.element.isRequired, | ||
}; | ||
RegistryProvider.childContextTypes = { | ||
registry: React.PropTypes.object, | ||
registry: PropTypes.object, | ||
}; |
308678
3852