GitHub

DaffCategoryFacadeInterface

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

A facade for interacting with the category state. This facade exposes many parts of the state for easy access and allows dispatching of actions.

interface DaffCategoryFacadeInterface<V extends DaffGenericCategory<V> = DaffCategory, W extends DaffProduct = DaffProduct> {
  category$: Observable<V>
  products$: Observable<W[]>
  isCategoryEmpty$: Observable<boolean>

  getCategoryById(id: V["id"]): Observable<V>
  getProductsByCategory(categoryId: V["id"]): Observable<W[]>
  getTotalProductsByCategory(categoryId: V["id"]): Observable<number>
}

Properties

category$
Observable<V>

The currently selected category.

products$
Observable<W[]>

Products of the current category.

isCategoryEmpty$
Observable<boolean>

Is the category page empty of products.

() Methods

getCategoryById
Observable<V>

Get a category by the provided Id.

Parameters
Parameterid: V["id"]
Description
getProductsByCategory
Observable<W[]>

Get products by a category Id.

Parameters
ParametercategoryId: V["id"]
Description
getTotalProductsByCategory
Observable<number>

Get products by a category Id.

Parameters
ParametercategoryId: V["id"]
Description