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