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 | 128x 128x 128x 128x 6x 128x 128x 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);
})
);
|