My Pages
"My Pages" refers to the account and profile management section.
Currently, customers can do the following:
- Sign up for a new account
- Sign in with an existing account
- Request a password reset (when not logged in)
- Reset their password (when not logged in)
- View a "My pages" dashboard, which contains their most-recent orders.
- View a full overview of all of their orders.
- View and edit their billing address
- Select their newsletter subscription preferences
- Change their password (when logged in)
Template Trend has a fully functional implementation of My Pages, including all of the above features.
There are a number of components and hooks that are included in Core to abstract away business logic while still allowing easy customisation of the shop template.
Implementation
For features that include forms, the business logic for each is generally
divided between Provider
components and hooks
. Each of these Provider
components contains the necessarily business logic and form setup for the
feature, and should wrap the part of the React tree that uses the hooks.
These Provider components provide their children with the context necessary
for the hooks to work.
For example, you will notice that in Trend, the SignUpPage
is wrapped with
a SignupFormProvider
. Inside that Provider is an Address
component. The
Address
component uses a hook called useAddressFields()
. This hook can be
used anywhere in the tree below the SignupFormProvider
, and may be used
multiple times if necessary. It consumes the logic provided by the
SignupFormProvider
.
The documentation that follows will describe each of these Providers and hooks in more detail.