Skip to content

Commit

Permalink
fix(customer): CHECKOUT-4596 Trim customer email
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Sanchez committed Feb 11, 2020
1 parent 0f72baf commit 653879e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/customer/Customer.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('Customer', () => {

(component.find(GuestForm) as ReactWrapper<GuestFormProps>)
.prop('onContinueAsGuest')({
email: 'test@bigcommerce.com',
email: ' test@bigcommerce.com ',
shouldSubscribe: true,
});

Expand Down
6 changes: 4 additions & 2 deletions src/app/customer/Customer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,14 @@ class Customer extends Component<CustomerProps & WithCheckoutCustomerProps> {
subscribeToNewsletter = noop,
} = this.props;

const email = formValues.email.trim();

if (canSubscribe && formValues.shouldSubscribe) {
subscribeToNewsletter({ email: formValues.email, firstName });
subscribeToNewsletter({ email, firstName });
}

try {
await continueAsGuest({ email: formValues.email });
await continueAsGuest({ email });
onContinueAsGuest();

this.draftEmail = undefined;
Expand Down

0 comments on commit 653879e

Please sign in to comment.