import { DaffCategoryFacade } 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.
@Injectable()
class DaffCategoryFacade<<V extends DaffGenericCategory<V> = DaffCategory, W extends DaffProduct = DaffProduct>> implements DaffCategoryFacadeInterface<V, W> {
category$: Observable<V>
loadingState$: Observable<DaffCategoryReducerState['daffState']>
loading$: Observable<boolean>
mutating$: Observable<boolean>
resolving$: Observable<boolean>
products$: Observable<W[]>
errors$: Observable<DaffStateError[]>
hasErrors$: Observable<boolean>
isCategoryEmpty$: Observable<boolean>
getCategoryById(id: V["id"]): Observable<V>
getProductsByCategory(categoryId: V["id"]): Observable<W[]>
getTotalProductsByCategory(categoryId: V["id"]): Observable<number>
dispatch(action: Action<string>): void
}
Observable| Default | – |
|---|---|
| Description | The currently selected category. |
Observable<DaffCategoryReducerState['daffState']>| Default | – |
|---|---|
| Description |
Observable| Default | – |
|---|---|
| Description |
Observable| Default | – |
|---|---|
| Description |
Observable| Default | – |
|---|---|
| Description |
Observable| Default | – |
|---|---|
| Description | Products of the current category. |
Observable<DaffStateError[]>| Default | – |
|---|---|
| Description |
Observable| Default | – |
|---|---|
| Description |
Observable| Default | – |
|---|---|
| Description | Is the category page empty of products. |
ObservableGet a category by the provided Id.
@param id
| Parameter | id: V["id"] |
|---|---|
| Description |
ObservableGet products by a category Id.
@param categoryId
| Parameter | categoryId: V["id"] |
|---|---|
| Description |
ObservableGet products by a category Id.
@param categoryId
| Parameter | categoryId: V["id"] |
|---|---|
| Description |
voidDispatches the given action.
| Parameter | action: Action |
|---|---|
| Description | action to dispatch. |