useAccount
The useAccount hook is a React hook to manage user login, signup and logout.
Usage
The useAccount hook provides utilities to simplify login, signup and logout.
const {login, signup, verify, logout, resetPassword, captchaRef} = useAccount()Parameters
No parameters
Return Values
| Name | Type | Description |
|---|---|---|
| login | function | See below |
| signup | function | See below |
| verify | function | See below |
| logout | function | See below |
| resetPassword | function | A function to set the quantity of the specified product variant to a specific value. |
| captchaRef | React Ref | A function to set the quantity of the specified product variant to a specific value. |
login
Parameters
login function accepts an object with the following properties
| Name | Type | Description |
|---|---|---|
| username | string | Login username, usually an email. |
| password | string | Login password |
Returns
Promise
signup
Parameters
signup function accepts an object with the following properties
| Name | Type | Description |
|---|---|---|
| firstName | string | First name of the user |
| lastName | string | Last name of the user |
| username | string | Login username, usually an email. |
| password | string | Login password |
Returns
Promise
logout
Parameters
No parameters
Returns
Promise