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 | 119x 119x 119x 119x 6x 119x 119x 3x 3x | import { EntityState, createEntityAdapter } from '@ngrx/entity'; import { createReducer, on } from '@ngrx/store'; import { Promotion } from 'ish-core/models/promotion/promotion.model'; import { loadPromotionSuccess } from './promotions.actions'; export const promotionAdapter = createEntityAdapter<Promotion>({ selectId: promotion => promotion.id, }); export type PromotionsState = EntityState<Promotion>; const initialState: PromotionsState = promotionAdapter.getInitialState({}); export const promotionsReducer = createReducer( initialState, on(loadPromotionSuccess, (state, action) => { const promotion = action.payload.promotion; return promotionAdapter.upsertOne(promotion, state); }) ); |