Interfaces

Interface: UseUser

react-autonomy.UseUser

UseUser contains the data and methods returned by the useUser hook.

Properties

loadUser

loadUser: () => Promise<void>

Type declaration

▸ (): Promise<void>

The loadUser function loads information about the current order's associated user from the Chord API.



JS


Returns

Promise<void>

A Promise that resolves when the user object has been added to Redux.

Defined in



loadUserAddressBook

loadUserAddressBook: () => Promise<AddressBook>

Type declaration

▸ (): 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.



JS


Returns

Promise<AddressBook>

A Promise that resolves when the array of addresses, addressBook has been added to Redux.

Defined in



loadUserReferralIdentifier

loadUserReferralIdentifier: (options: LoadUserReferralIdentifier) => Promise<ReferralIdentifier>

Type declaration

▸ (options): Promise<ReferralIdentifier>

The loadUserReferralIdentifier function loads the referral identifier information for a user with the given email address from the Chord API.



JS


Parameters

Name

Type

options

Returns

Promise<ReferralIdentifier>

A Promise that resolves when the referralIdentifier object has been added to the user object in Redux.

Defined in



loadUserStoreCreditEvents

loadUserStoreCreditEvents: () => Promise<StoreCreditEvents>

Type declaration

▸ (): 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.



JS


Returns

Promise<StoreCreditEvents>

A Promise that resolves when the array of storeCreditEvents has been added to Redux.

Defined in



modifyUser

modifyUser: (options: ModifyUser) => Promise<void>

Type declaration

▸ (options): Promise<void>

The modifyUser function is used to update the user's profile information.



JS


Parameters

Name

Type

options

ModifyUser

Returns

Promise<void>

A Promise that resolves when the user object has been updated in Redux.

Defined in



modifyUserAddressBook

modifyUserAddressBook: (address: UpdateAddressInput) => Promise<AddressBook>

Type declaration

▸ (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.



JS


Parameters

Name

Type

address

UpdateAddressInput

Returns

Promise<AddressBook>

A Promise that resolves when the array of addresses, addressBook has been updated in Redux.

Defined in



removeFromUserAddressBook

removeFromUserAddressBook: (addressId: number) => Promise<void>

Type declaration

▸ (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.



JS


Parameters

Name

Type

addressId

number

Returns

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.

Defined in



user

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.



JS


Type declaration

Name

Type

addressBook

AddressBook

data

User | Record<string, never>

referralIdentifier

string

storeCreditEvents

Defined in