1 import { createReducer, on } from '@ngrx/store';
2 import { Vorgang } from '../vorgang';
3 import { create } from '../actions/vorgang';
5 export interface State {
9 export const initialState: State = { vorgaenge : [] };
11 const REDUCER = createReducer(
13 on(create, (state, props) => {
14 console.log(`Old state: ${JSON.stringify(state)}, props: ${JSON.stringify(props)}`);
15 const vorgaenge: Vorgang[] = [ props.vorgang ];
16 state.vorgaenge.forEach(val => vorgaenge.push(Object.assign({}, val)));
21 export function reducer(state, action): State {
22 return REDUCER(state, action);