export function reducer()

in src/app/groups/store/definition/definition.reducer.ts [31:60]


export function reducer(state = initialState, action: groupDefinition.Actions): ResourceState {

  switch (action.type) {

    case groupDefinition.LOAD_ALL: {
      return initialState;
    }

    case groupDefinition.LOAD_ALL_COMPLETE: {
      const groupDefinitions1: GroupDefinition[] = action.payload;

      const ids = groupDefinitions1.map(groupDefinition => groupDefinition.identifier);

      const entities = resourcesToHash(groupDefinitions1);

      const loadedAt = idsToHashWithCurrentTimestamp(ids);

      return {
        ids: [ ...ids ],
        entities: entities,
        loadedAt: loadedAt,
        selectedId: state.selectedId
      };
    }

    default: {
      return state;
    }
  }
}