Skip to main content

Function: useFavorites()

useFavorites(options): UseFavoritesReturn

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

useFavorites — favorite-list CRUD with optimistic updates.

Parameters

options

UseFavoritesOptions

see UseFavoritesOptions.

Returns

UseFavoritesReturn

list state, edit-form state and async actions — see UseFavoritesReturn.

Remarks

GraphQL integration: all mutations go through services.favoriteList (FavoriteListService), built per-call via createServices(graphqlClient). fetchLists is local-only — it reads user.favoriteLists.items and makes no API call. createList calls createFavoriteList (with contactId/customerId from the user); updateList calls updateFavoriteList; deleteList calls deleteFavoriteList (optimistically removing the list and re-adding it on error); addToList / removeFromList call addFavoriteListItems / removeFavoriteListItems. Setting a list as default first clears the previous default via updateFavoriteList. All mutations require an authenticated session; any on* callback fully overrides its default API call.