Interface: UseUser
react-autonomy.UseUser
UseUser contains the data and methods returned by the useUser hook.
• loadUser: () => Promise<void>
▸ (): Promise<void>
The loadUser function loads information about the current order's associated user from the Chord API.
Promise<void>
A Promise that resolves when the user object has been added to Redux.
• loadUserAddressBook: () => Promise<AddressBook>
▸ (): Promise<AddressBook>
The loadUserAddressBook function loads the current user's stored addresses. A user must be already logged in for this method to work properly.
Promise<AddressBook>
A Promise that resolves when the array of addresses, addressBook has been added to Redux.
• loadUserReferralIdentifier: (options: LoadUserReferralIdentifier) => Promise<ReferralIdentifier>
▸ (options): Promise<ReferralIdentifier>
The loadUserReferralIdentifier function loads the referral identifier information for a user with the given email address from the Chord API.
Name | Type |
---|---|
options |
Promise<ReferralIdentifier>
A Promise that resolves when the referralIdentifier object has been added to the user object in Redux.
• loadUserStoreCreditEvents: () => Promise<StoreCreditEvents>
▸ (): Promise<StoreCreditEvents>
The loadUserStoreCreditEvents function loads information about the current user's store credit history. A user must be already logged in for this method to work properly.
Promise<StoreCreditEvents>
A Promise that resolves when the array of storeCreditEvents has been added to Redux.
• modifyUser: (options: ModifyUser) => Promise<void>
▸ (options): Promise<void>
The modifyUser function is used to update the user's profile information.
Name | Type |
---|---|
options | ModifyUser |
Promise<void>
A Promise that resolves when the user object has been updated in Redux.
• modifyUserAddressBook: (address: UpdateAddressInput) => Promise<AddressBook>
▸ (address): Promise<AddressBook>
The modifyUserAddressBook function updates an address the current user's stored addresses. A user must be already logged in for this method to work properly.
Name | Type |
---|---|
address | UpdateAddressInput |
Promise<AddressBook>
A Promise that resolves when the array of addresses, addressBook has been updated in Redux.
• removeFromUserAddressBook: (addressId: number) => Promise<void>
▸ (addressId): Promise<void>
The removeFromUserAddressBook function removes an address the current user's stored addresses. A user must be already logged in for this method to work properly.
Name | Type |
---|---|
addressId | number |
Promise<void>
A Promise that resolves when the array of addresses, addressBook has been updated in Redux to reflect the removal of the address id passed to this function.
• user: Object
Chord's user state.
The data property contains the user's information. It will be an empty object if the user is not logged in, which allows for top level optional chaining.
Name | Type |
---|---|
addressBook | AddressBook |
data | User | Record<string, never> |
referralIdentifier | string |
storeCreditEvents |