SalePage and panel uses storableError func and correct proptype validation.

This commit is contained in:
Vesa Luusua 2017-10-17 19:46:26 +03:00
parent d8520f8e6d
commit f68cf153af
3 changed files with 13 additions and 12 deletions

View file

@ -267,7 +267,7 @@ SaleDetailsPanelComponent.defaultProps = {
declineSaleError: null,
};
const { string, func, bool, instanceOf } = PropTypes;
const { bool, func, string } = PropTypes;
SaleDetailsPanelComponent.propTypes = {
rootClassName: string,
@ -277,8 +277,8 @@ SaleDetailsPanelComponent.propTypes = {
onDeclineSale: func.isRequired,
acceptInProgress: bool.isRequired,
declineInProgress: bool.isRequired,
acceptSaleError: instanceOf(Error),
declineSaleError: instanceOf(Error),
acceptSaleError: propTypes.error,
declineSaleError: propTypes.error,
// from injectIntl
intl: intlShape.isRequired,

View file

@ -1,4 +1,5 @@
import { types } from '../../util/sdkLoader';
import { storableError } from '../../util/errors';
import * as propTypes from '../../util/propTypes';
import * as log from '../../util/log';
import { addMarketplaceEntities } from '../../ducks/marketplaceData.duck';
@ -122,7 +123,7 @@ export const fetchSale = id => (dispatch, getState, sdk) => {
return response;
})
.catch(e => {
dispatch(fetchSaleError(e));
dispatch(fetchSaleError(storableError(e)));
throw e;
});
};
@ -142,7 +143,7 @@ export const acceptSale = id => (dispatch, getState, sdk) => {
return response;
})
.catch(e => {
dispatch(acceptSaleError(e));
dispatch(acceptSaleError(storableError(e)));
log.error(e, 'accept-sale-failed', {
txId: id,
transition: propTypes.TX_TRANSITION_ACCEPT,
@ -166,7 +167,7 @@ export const declineSale = id => (dispatch, getState, sdk) => {
return response;
})
.catch(e => {
dispatch(declineSaleError(e));
dispatch(declineSaleError(storableError(e)));
log.error(e, 'redect-sale-failed', {
txId: id,
transition: propTypes.TX_TRANSITION_DECLINE,

View file

@ -103,18 +103,18 @@ SalePageComponent.defaultProps = {
transaction: null,
};
const { bool, func, instanceOf, oneOf, shape, string } = PropTypes;
const { bool, func, oneOf, shape, string } = PropTypes;
SalePageComponent.propTypes = {
authInfoError: instanceOf(Error),
authInfoError: propTypes.error,
currentUser: propTypes.currentUser,
fetchSaleError: instanceOf(Error),
acceptSaleError: instanceOf(Error),
declineSaleError: instanceOf(Error),
fetchSaleError: propTypes.error,
acceptSaleError: propTypes.error,
declineSaleError: propTypes.error,
acceptInProgress: bool.isRequired,
declineInProgress: bool.isRequired,
intl: intlShape.isRequired,
logoutError: instanceOf(Error),
logoutError: propTypes.error,
onAcceptSale: func.isRequired,
onDeclineSale: func.isRequired,
params: shape({ id: string }).isRequired,