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 29 30 31 32 33 | 32x 32x 32x 32x 32x 16x 32x 32x 8x 8x | import { EntityState, createEntityAdapter } from '@ngrx/entity';
import { createReducer, on } from '@ngrx/store';
import { ContentPageletEntryPoint } from 'ish-core/models/content-pagelet-entry-point/content-pagelet-entry-point.model';
import { setLoadingOn, unsetLoadingOn } from 'ish-core/utils/ngrx-creators';
import { loadContentPage, loadContentPageFail, loadContentPageSuccess } from './pages.actions';
export const pagesAdapter = createEntityAdapter<ContentPageletEntryPoint>({
selectId: contentPage => contentPage.id,
});
export interface PagesState extends EntityState<ContentPageletEntryPoint> {
loading: boolean;
}
const initialState: PagesState = pagesAdapter.getInitialState({
loading: false,
});
export const pagesReducer = createReducer(
initialState,
setLoadingOn(loadContentPage),
unsetLoadingOn(loadContentPageFail, loadContentPageSuccess),
on(loadContentPageSuccess, (state, action) => {
const { page } = action.payload;
return {
...pagesAdapter.upsertOne(page, state),
};
})
);
|