useAccount
The useAccount hook exposes the platform’s account URLs, for linking to the account pages.
Login, signup, profile and orders are platform pages rendered outside the theme (by platform-web), not by your theme. Link to them with a plain
<a>tag (a full page load) using theurlsbelow — the theme never renders account UI or calls auth APIs itself.
Usage
const {urls} = useAccount()
// e.g. in a header account menu — plain anchors, since these leave the theme SPA:
<a href={urls.login}>Login</a>
<a href={urls.orders}>Orders</a>
<a href={urls.logout}>Logout</a>In development the account pages show a dev notice; /account/login offers a dev login that
signs in the fixtures/user.js customer (see Sample data), and
urls.logout signs out again — so useUser()-driven UI is fully testable locally.
Parameters
No parameters
Return Values
| Name | Type | Description |
|---|---|---|
| urls | object | The platform account page URLs — see below. |
urls
| Name | Type | Description |
|---|---|---|
| login | string | Login page — `/account/login` |
| signup | string | Signup page — `/account/signup` |
| logout | string | Logout — `/account/logout` |
| account | string | Account/profile — `/account` |
| orders | string | Order history — `/account/orders` |