GitHub

DaffCategoryMemoizedSelectors

Type

import { DaffCategoryMemoizedSelectors } from '@daffodil/category/state'

An interface for selectors that combine category metadata and category entities selectors.

interface DaffCategoryMemoizedSelectors<V extends DaffGenericCategory<V> = DaffCategory, W extends DaffProduct = DaffProduct> {
  selectCurrentCategory: MemoizedSelector<DaffCategoryStateRootSlice<V>, V>
  selectCategoryPageProducts: MemoizedSelector<DaffCategoryStateRootSlice<V, W>, W[]>
  selectCategory: (categoryId: V["id"]) => any
  selectProductsByCategory: (categoryId: V["id"]) => any
  selectTotalProductsByCategory: (categoryId: V["id"]) => any
}

Properties

selectCurrentCategory
MemoizedSelector<DaffCategoryStateRootSlice<V>, V>

Selects the current category

selectCategoryPageProducts
MemoizedSelector<DaffCategoryStateRootSlice<V, W>, W[]>

Selects the products of the current category.

selectCategory
(categoryId: V["id"]) => any

Selects a category by id.

selectProductsByCategory
(categoryId: V["id"]) => any

Selects products by category id.

selectTotalProductsByCategory
(categoryId: V["id"]) => any

Selects the total number of products in a category.