Skip to content

Commit

Permalink
fix(pageconfirm): bug fix for "remember me" when pick up
Browse files Browse the repository at this point in the history
  • Loading branch information
limyifan1 committed Jun 29, 2020
1 parent cfddd02 commit 304e1cc
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/Components/PageConfirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ class FullScreenDialog extends Component {
this.setState({
postal: inputValue,
});
if (inputValue.length === 6) {

if (inputValue.length === 6 && this.context.channel === "delivery") {
this.getPostal(inputValue);
}
}
Expand Down Expand Up @@ -173,10 +174,10 @@ class FullScreenDialog extends Component {
async getPostal(postal) {
this.setState({ loading: true });
let data = await this.callPostal(postal);
if (data !== undefined) {
if (data !== undefined && data["ADDRESS"]) {
this.context.addCustomerDetails("street", data["ADDRESS"]);
}
if (this.context.delivery_option === "distance") {
if (this.context.delivery_option === "distance" && data["ADDRESS"]) {
let distance = await this.getDirections(
this.context.pageData.street,
data["ADDRESS"]
Expand All @@ -198,8 +199,10 @@ class FullScreenDialog extends Component {
this.context.addCustomerDetails("postal", userDetails.postal);
this.context.addCustomerDetails("unit", userDetails.unit);
this.context.addCustomerDetails("street", userDetails.street);
this.getPostal(userDetails.postal);
// this.setState(userDetails);
if (this.context.channel === "delivery") {
this.getPostal(userDetails.postal);
// this.setState(userDetails);
}
this.setState({ shouldRememberDetails: true });
}
}
Expand Down Expand Up @@ -831,6 +834,14 @@ class FullScreenDialog extends Component {
}}
></input>
</div>
<div>
For any problems, please contact{" "}
<a href={"https://wa.me/65" + this.context.pageData.contact}>
{this.context.pageData.contact}{" "}
</a>
directly.
</div>
<br />
{this.props.toggle === "cart" ? (
<React.Fragment>
{!this.state.loading ? (
Expand Down

1 comment on commit 304e1cc

@vercel
Copy link

@vercel vercel bot commented on 304e1cc Jun 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.