Skip to content

Commit

Permalink
Correct the state values in addToCart-callback, fixes #71
Browse files Browse the repository at this point in the history
  • Loading branch information
tjjalava committed Aug 22, 2017
1 parent fee9c20 commit e17b75e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/SizeMeApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ SizeMeApp.propTypes = {

const mapStateToProps = state => ({
resolved: state.authToken.resolved && state.productInfo.resolved,
loggedIn: state.authToken.loggedIn,
sizemeProductPage: state.productInfo.product !== null,
selectedSize: state.selectedSize,
matchResult: state.match.matchResult,
measurementInputs: Optional.ofNullable(state.productInfo.product).flatMap(p => Optional.ofNullable(p.model))
Expand Down
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ const { addToCartElement, addToCartEvent } = uiOptions;
if (addToCartElement && addToCartEvent) {
const elements = document.querySelectorAll(addToCartElement);
const fn = () => {
const { loggedIn, sizemeProductPage } = sizemeStore.getState();
const { authToken, productInfo } = sizemeStore.getState();
const loggedIn = authToken.loggedIn;
const sizemeProductPage = productInfo.product !== null;
if (loggedIn && sizemeProductPage) {
trackEvent("addToCartSM", "Store: Product added to cart by SizeMe user");
} else if (loggedIn && !sizemeProductPage) {
Expand Down

0 comments on commit e17b75e

Please sign in to comment.