Skip to content

Commit

Permalink
editorial: fix bad example
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscaceres committed Jun 21, 2018
1 parent b336891 commit 0d2ab3a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -475,15 +475,14 @@ <h3>
};
// Sync update to the total
request.onshippingoptionchange = ev =&gt; {
const shippingOption = shippingOptions.find(
option =&gt; option.id === request.id
);
// selected shipping option
const { shippingOption } = request;
const newTotal = {
currency: "USD",
label: "Total due",
value: calculateNewTotal(shippingOption),
};
ev.updateWith({ ...details, total: newTotal });
ev.updateWith({ total: newTotal });
};
async function checkShipping(request) {
try {
Expand All @@ -492,9 +491,9 @@ <h3>
await ensureCanShipTo(json);
const { shippingOptions, total } = await calculateShipping(json);

return { ...details, shippingOptions, total };
return { shippingOptions, total };
} catch (err) {
return { ...details, error: `Sorry! we can't ship to your address.` };
return { error: `Sorry! we can't ship to your address.` };
}
}
</pre>
Expand Down

0 comments on commit 0d2ab3a

Please sign in to comment.