Skip to content

Commit

Permalink
Extract order creation to group core logic in the center of an ”imp…
Browse files Browse the repository at this point in the history
…ureim sandwich“
  • Loading branch information
bespoyasov committed Jan 21, 2022
1 parent 62d16cb commit aca4619
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,17 @@ function App() {
discount = 0;
}

const order = {
user: _userId,
products,
total,
discount,
};

// Pretend like this is an API call =)
const res = await new Promise((resolve) => {
setTimeout(() => {
console.log({
user: _userId,
products,
total,
discount,
});
console.log(order);
resolve("some-order-id");
}, 500);
});
Expand Down

0 comments on commit aca4619

Please sign in to comment.