components/customer/LoginHandler.js
/**
   * Perform a request to Commerce.js to log the user in by their email address. If the
   * user's email address exists, a login link will be emailed to them.
   *
   * @see https://commercejs.com/docs/api/#issue-and-send-login-token
   */
Perform a request to Commerce.js to log the user in by their email address. If the
user's email address exists, a login link will be emailed to them.


Perform a request to Commerce . js to log the user in by their email address . If the user ' s email address exists a login link will be emailed to them .
loginCustomer(e) {
    e.preventDefault();
    const { email } = this.state;
    const { t } = this.props;
    this.setState({
      isError: false,
      message: null,
    });
    return commerce.customer.login(
      email,
      `${window.location.origin}/login?token={token}`
    )
      .then((result) => {
        this.setState({
          isError: false,
          email: '',
          message: [
            t('login.linkConfirmation')
          ]
        });
      })
      .catch((error)=>{
        this.setState({
          isError: true,
          message: error.data.error.errors.email,
        });
      });
  }
loginCustomer ( e ) { e . preventDefault ( ) ; const { email } = this . state ; const { t } = this . props ; this . setState ( { isError : false , message : null , } ) ; return commerce . customer . login ( email , ` ${ window . location . origin } ` ) . then ( ( result ) => { this . setState ( { isError : false , email : '' , message : [ t ( 'login.linkConfirmation' ) ] } ) ; } ) . catch ( ( error ) => { this . setState ( { isError : true , message : error . data . error . errors . email , } ) ; } ) ; }
Perform a request to Commerce.js to log the user in by their email address.
Perform a request to Commerce . js to log the user in by their email address .
// Reset messaging.