Clear discount on transition
This commit is contained in:
@ -188,11 +188,11 @@ export default contain(
|
||||
</Col>
|
||||
<Col
|
||||
md={ 6 }>
|
||||
<h4>+{ price }</h4>
|
||||
<h4>+ { price }</h4>
|
||||
</Col>
|
||||
</Row>
|
||||
{ this.renderDiscount(discountAmount) }
|
||||
{ this.renderHighlightPrice(isHighlighted) }
|
||||
{ this.renderDiscount(discountAmount) }
|
||||
<Row>
|
||||
<Col
|
||||
md={ 3 }
|
||||
|
@ -1,4 +1,5 @@
|
||||
import React, { PropTypes } from 'react';
|
||||
import { Lifecycle } from 'react-router';
|
||||
import { Panel, Button, Row, Col } from 'react-bootstrap';
|
||||
import { contain } from 'thundercats-react';
|
||||
|
||||
@ -25,6 +26,8 @@ export default contain(
|
||||
jobActions: PropTypes.object
|
||||
},
|
||||
|
||||
mixins: [Lifecycle],
|
||||
|
||||
componentDidMount() {
|
||||
const { appActions, job } = this.props;
|
||||
// redirect user in client
|
||||
@ -33,6 +36,11 @@ export default contain(
|
||||
}
|
||||
},
|
||||
|
||||
routerWillLeave() {
|
||||
const { jobActions } = this.props;
|
||||
jobActions.clearPromo();
|
||||
},
|
||||
|
||||
render() {
|
||||
const { appActions, job, jobActions } = this.props;
|
||||
|
||||
|
@ -71,6 +71,16 @@ export default Actions({
|
||||
return { promoCode: value.replace(/[^\d\w\s]/, '') };
|
||||
},
|
||||
applyCode: null,
|
||||
clearPromo(foo, undef) {
|
||||
return {
|
||||
price: undef,
|
||||
buttonId: undef,
|
||||
discountAmount: undef,
|
||||
promoCode: undef,
|
||||
promoApplied: false,
|
||||
promoName: undef
|
||||
};
|
||||
},
|
||||
applyPromo({
|
||||
fullPrice: price,
|
||||
buttonId,
|
||||
|
@ -22,7 +22,8 @@ export default Store({
|
||||
setForm,
|
||||
setFollowersCount,
|
||||
setPromoCode,
|
||||
applyPromo
|
||||
applyPromo,
|
||||
clearPromo
|
||||
} = cat.getActions('JobActions');
|
||||
const register = createRegistrar(jobsStore);
|
||||
register(setter(setJobs));
|
||||
@ -32,6 +33,7 @@ export default Store({
|
||||
register(setter(setForm));
|
||||
register(setter(setPromoCode));
|
||||
register(setter(applyPromo));
|
||||
register(setter(clearPromo));
|
||||
register(setter(setFollowersCount));
|
||||
|
||||
register(transformer(findJob));
|
||||
|
Reference in New Issue
Block a user