Skip to main content

Interface: UseFavoritesReturn

Defined in: composables/react/useFavorites.ts:63

State and favorite-list actions returned by useFavorites.

Properties​

addToList​

addToList: (listId, productId?, clusterId?) => Promise<void>

Defined in: composables/react/useFavorites.ts:107

Adds a product and/or cluster to a list.

Parameters​

listId​

string

productId?​

number

clusterId?​

number

Returns​

Promise<void>


cancelEdit​

cancelEdit: () => void

Defined in: composables/react/useFavorites.ts:89

Exits edit mode and clears the edit fields.

Returns​

void


confirmDelete​

confirmDelete: (list) => void

Defined in: composables/react/useFavorites.ts:101

Stages a list for delete confirmation.

Parameters​

list​

FavoriteList

Returns​

void


createList​

createList: (name, isDefault) => Promise<void>

Defined in: composables/react/useFavorites.ts:105

Creates a new favorite list.

Parameters​

name​

string

isDefault​

boolean

Returns​

Promise<void>


deleteList​

deleteList: () => Promise<void>

Defined in: composables/react/useFavorites.ts:103

Deletes the staged list, with optimistic removal and rollback on failure.

Returns​

Promise<void>


editingListId​

editingListId: string | null

Defined in: composables/react/useFavorites.ts:73

Id of the list currently being edited, or null.


editListName​

editListName: string

Defined in: composables/react/useFavorites.ts:75

Working copy of the edited list's name.


editSetAsDefault​

editSetAsDefault: boolean

Defined in: composables/react/useFavorites.ts:77

Working copy of the edited list's default flag.


error​

error: string | null

Defined in: composables/react/useFavorites.ts:71

Last error message, or null.


fetchLists​

fetchLists: () => void

Defined in: composables/react/useFavorites.ts:85

Re-reads the lists from the current user object.

Returns​

void


isProductInList​

isProductInList: (listId, productId) => boolean

Defined in: composables/react/useFavorites.ts:115

true when the list already contains the given product id.

Parameters​

listId​

string

productId​

number

Returns​

boolean


lists​

lists: FavoriteList[]

Defined in: composables/react/useFavorites.ts:65

The user's favorite lists.


listToDelete​

listToDelete: FavoriteList | null

Defined in: composables/react/useFavorites.ts:83

List staged for deletion confirmation, or null.


loading​

loading: boolean

Defined in: composables/react/useFavorites.ts:67

Always false — lists are read synchronously from the user object.


newListName​

newListName: string

Defined in: composables/react/useFavorites.ts:79

Draft name for a new list.


newSetAsDefault​

newSetAsDefault: boolean

Defined in: composables/react/useFavorites.ts:81

Draft default flag for a new list.


removeFromList​

removeFromList: (listId, productId?, clusterId?) => Promise<void>

Defined in: composables/react/useFavorites.ts:109

Removes one or more products/clusters from a list.

Parameters​

listId​

string

productId?​

number | number[]

clusterId?​

number | number[]

Returns​

Promise<void>


saving​

saving: boolean

Defined in: composables/react/useFavorites.ts:69

true while a create / update / delete call is in flight.


setEditListName​

setEditListName: (name) => void

Defined in: composables/react/useFavorites.ts:91

Sets the working edit name.

Parameters​

name​

string

Returns​

void


setEditSetAsDefault​

setEditSetAsDefault: (v) => void

Defined in: composables/react/useFavorites.ts:93

Sets the working edit default flag.

Parameters​

v​

boolean

Returns​

void


setNewListName​

setNewListName: (name) => void

Defined in: composables/react/useFavorites.ts:95

Sets the draft name for a new list.

Parameters​

name​

string

Returns​

void


setNewSetAsDefault​

setNewSetAsDefault: (v) => void

Defined in: composables/react/useFavorites.ts:97

Sets the draft default flag for a new list.

Parameters​

v​

boolean

Returns​

void


startEdit​

startEdit: (list) => void

Defined in: composables/react/useFavorites.ts:87

Enters edit mode for a list, seeding the edit fields.

Parameters​

list​

FavoriteList

Returns​

void


updateList​

updateList: (listId) => Promise<void>

Defined in: composables/react/useFavorites.ts:99

Persists the in-progress edit to the given list id.

Parameters​

listId​

string

Returns​

Promise<void>