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 | 8x 8x 8x 8x 16x 16x 8x | import { createReducer, on } from '@ngrx/store'; import { ContentPageTreeHelper } from 'ish-core/models/content-page-tree/content-page-tree.helper'; import { ContentPageTree } from 'ish-core/models/content-page-tree/content-page-tree.model'; import { loadContentPageTreeSuccess } from './page-tree.actions'; export interface PageTreeState { pagetree: ContentPageTree; } const initialState: PageTreeState = { pagetree: ContentPageTreeHelper.empty(), }; function mergePageTrees(state: PageTreeState, action: ReturnType<typeof loadContentPageTreeSuccess>) { const pagetree = action.payload.pagetree; return pagetree ? { ...state, pagetree: ContentPageTreeHelper.merge(state.pagetree, pagetree), } : { ...state }; } export const pageTreeReducer = createReducer(initialState, on(loadContentPageTreeSuccess, mergePageTrees)); |