Building a my account page
Now that we're allowing our users to place orders, we should really give them a page to view all of their previously placed orders as well. You'd normally find this information somewhere within a My Account
section of most online shops, so we'll build a my account page here as well. The following template
section belongs in a new ClientApp/pages/Account.vue
file:
<template> <b-containerclass="page pt-4"> <h1>My Account</h1> <order-list:orders="orders"/> </b-container> </template>
Nothing special here, just the My Account
heading and a new order-list
component, which we'll define shortly. Note that we're binding an orders
prop to a component property of the same name, which will eventually be populated with the list of orders that we'll retrieve from our backend API.
The script
section for this page component is a little more involved, so we'll build it up in stages. Start by adding the following standard component...