This course has been updated! We now recommend you take the Build Progressive Web Apps (PWAs) from Scratch course.

Check out a free preview of the full Progressive Web Applications and Offline course:
The "Challenge 5: Using Fetch, Part 2" Lesson is part of the full, Progressive Web Applications and Offline course featured in this preview video. Here's what you'd learn in this lesson:

In this challenge, students code the cart so that when a user checks out the contents of their cart are persisted so than an order is created.

Get Unlimited Access Now

Transcript from the "Challenge 5: Using Fetch, Part 2" Lesson

>> Steve Kinney: We can also do the checkout. So you put stuff in the cart, neat. That's an exercise in futility if you can't actually place the order. In the cart store, there is a method called do checkout. This is very important, it handles the very important job of doing the checkout.

>> Steve Kinney: And in the other case, we're going to want to go ahead and actually send the order, right? After the API call is completed, and we have dude the checkout, we want to call restore cart to upstate the client's view with any other change that might have happened as a result of the order creation, right?

[00:00:40] The order's been created, empty the cart, so on and so forth, right? There is a restore cart method.