Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 5x 5x 5x 5x 15x 6x 5x 5x 5x 1x 5x 1x 1x | import { createSelector } from '@ngrx/store';
import {
ProductNotification,
ProductNotificationType,
} from '../../models/product-notification/product-notification.model';
import { getProductNotificationsState } from '../product-notifications-store';
import { initialState, productNotificationAdapter } from './product-notification.reducer';
const getProductNotificationState = createSelector(getProductNotificationsState, state =>
state ? state.productNotifications : initialState
);
export const getProductNotificationsLoading = createSelector(getProductNotificationState, state => state.loading);
export const getProductNotificationsError = createSelector(getProductNotificationState, state => state.error);
export const { selectAll } = productNotificationAdapter.getSelectors(getProductNotificationState);
export const getProductNotificationsByType = (type: ProductNotificationType) =>
createSelector(selectAll, (entities): ProductNotification[] => entities.filter(e => e.type === type));
export const getProductNotificationBySku = (sku: string, type: ProductNotificationType) =>
createSelector(selectAll, (entities): ProductNotification[] =>
entities.filter(e => e.sku === sku && e.type === type)
);
|