Skip to main content

Interface: UseFavoritesReturn

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

State and favorite-list actions returned by useFavorites.

Properties

addToList

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

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

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:73

Exits edit mode and clears the edit fields.

Returns

void


confirmDelete

confirmDelete: (list) => void

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

Stages a list for delete confirmation.

Parameters

list

FavoriteList

Returns

void


createList

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

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

Creates a new favorite list.

Parameters

name

string

isDefault

boolean

Returns

Promise<void>


deleteList

deleteList: () => Promise<void>

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

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

Returns

Promise<void>


editingListId

editingListId: string | null

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

Id of the list currently being edited, or null.


editListName

editListName: string

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

Working copy of the edited list's name.


editSetAsDefault

editSetAsDefault: boolean

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

Working copy of the edited list's default flag.


error

error: string | null

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

Last error message, or null.


fetchLists

fetchLists: () => void

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

Re-reads the lists from the current user object.

Returns

void


isProductInList

isProductInList: (listId, productId) => boolean

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

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:49

The user's favorite lists.


listToDelete

listToDelete: FavoriteList | null

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

List staged for deletion confirmation, or null.


loading

loading: boolean

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

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


newListName

newListName: string

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

Draft name for a new list.


newSetAsDefault

newSetAsDefault: boolean

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

Draft default flag for a new list.


removeFromList

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

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

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:53

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


setEditListName

setEditListName: (name) => void

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

Sets the working edit name.

Parameters

name

string

Returns

void


setEditSetAsDefault

setEditSetAsDefault: (v) => void

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

Sets the working edit default flag.

Parameters

v

boolean

Returns

void


setNewListName

setNewListName: (name) => void

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

Sets the draft name for a new list.

Parameters

name

string

Returns

void


setNewSetAsDefault

setNewSetAsDefault: (v) => void

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

Sets the draft default flag for a new list.

Parameters

v

boolean

Returns

void


startEdit

startEdit: (list) => void

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

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:83

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

Parameters

listId

string

Returns

Promise<void>