mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-25 22:37:18 +10:00
Update ListingPage: clear prev errors from stripe and CheckoutPage stores
This commit is contained in:
parent
e91eaa3866
commit
8a71845830
2 changed files with 15 additions and 1 deletions
|
|
@ -27,6 +27,7 @@ import {
|
|||
import { richText } from '../../util/richText';
|
||||
import { getMarketplaceEntities } from '../../ducks/marketplaceData.duck';
|
||||
import { manageDisableScrolling, isScrollingDisabled } from '../../ducks/UI.duck';
|
||||
import { initializeCardPaymentData } from '../../ducks/stripe.duck.js';
|
||||
import {
|
||||
Page,
|
||||
NamedLink,
|
||||
|
|
@ -90,7 +91,13 @@ export class ListingPageComponent extends Component {
|
|||
}
|
||||
|
||||
handleSubmit(values) {
|
||||
const { history, getListing, params, callSetInitialValues } = this.props;
|
||||
const {
|
||||
history,
|
||||
getListing,
|
||||
params,
|
||||
callSetInitialValues,
|
||||
onInitializeCardPaymentData,
|
||||
} = this.props;
|
||||
const listingId = new UUID(params.id);
|
||||
const listing = getListing(listingId);
|
||||
|
||||
|
|
@ -103,6 +110,7 @@ export class ListingPageComponent extends Component {
|
|||
bookingStart: bookingDates.startDate,
|
||||
bookingEnd: bookingDates.endDate,
|
||||
},
|
||||
confirmPaymentError: null,
|
||||
};
|
||||
|
||||
const routes = routeConfiguration();
|
||||
|
|
@ -110,6 +118,9 @@ export class ListingPageComponent extends Component {
|
|||
const { setInitialValues } = findRouteByRouteName('CheckoutPage', routes);
|
||||
callSetInitialValues(setInitialValues, initialValues);
|
||||
|
||||
// Clear previous Stripe errors from store if there is any
|
||||
onInitializeCardPaymentData();
|
||||
|
||||
// Redirect to CheckoutPage
|
||||
history.push(
|
||||
createResourceLocatorString(
|
||||
|
|
@ -512,6 +523,7 @@ ListingPageComponent.propTypes = {
|
|||
sendEnquiryInProgress: bool.isRequired,
|
||||
sendEnquiryError: propTypes.error,
|
||||
onSendEnquiry: func.isRequired,
|
||||
onInitializeCardPaymentData: func.isRequired,
|
||||
|
||||
categoriesConfig: array,
|
||||
amenitiesConfig: array,
|
||||
|
|
@ -565,6 +577,7 @@ const mapDispatchToProps = dispatch => ({
|
|||
dispatch(manageDisableScrolling(componentId, disableScrolling)),
|
||||
callSetInitialValues: (setInitialValues, values) => dispatch(setInitialValues(values)),
|
||||
onSendEnquiry: (listingId, message) => dispatch(sendEnquiry(listingId, message)),
|
||||
onInitializeCardPaymentData: () => dispatch(initializeCardPaymentData()),
|
||||
});
|
||||
|
||||
// Note: it is important that the withRouter HOC is **outside** the
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ describe('ListingPage', () => {
|
|||
callSetInitialValues: noop,
|
||||
sendVerificationEmailInProgress: false,
|
||||
onResendVerificationEmail: noop,
|
||||
onInitializeCardPaymentData: noop,
|
||||
sendEnquiryInProgress: false,
|
||||
onSendEnquiry: noop,
|
||||
categoriesConfig,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue