From aef3c5fe5e85761a160696c05e576c68baa28245 Mon Sep 17 00:00:00 2001 From: Mike Ryan Date: Fri, 6 Sep 2019 07:26:58 -0700 Subject: [PATCH] 04-setting-up-the-store --- src/app/shared/state/books.reducer.ts | 6 +++++- src/app/shared/state/index.ts | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/app/shared/state/books.reducer.ts b/src/app/shared/state/books.reducer.ts index 53fe775..fbd7925 100644 --- a/src/app/shared/state/books.reducer.ts +++ b/src/app/shared/state/books.reducer.ts @@ -1,4 +1,4 @@ -import { createReducer, on } from "@ngrx/store"; +import { createReducer, on, Action } from "@ngrx/store"; import { BookModel } from "src/app/shared/models/book.model"; import { BooksPageActions } from "src/app/books/actions"; @@ -35,3 +35,7 @@ export const booksReducer = createReducer( }; }) ); + +export function reducer(state: State | undefined, action: Action) { + return booksReducer(state, action); +} diff --git a/src/app/shared/state/index.ts b/src/app/shared/state/index.ts index f2ca2c4..5146601 100644 --- a/src/app/shared/state/index.ts +++ b/src/app/shared/state/index.ts @@ -1,8 +1,13 @@ import { ActionReducerMap, createSelector, MetaReducer } from "@ngrx/store"; +import * as fromBooks from "./books.reducer"; -export interface State {} +export interface State { + books: fromBooks.State; +} -export const reducers: ActionReducerMap = {}; +export const reducers: ActionReducerMap = { + books: fromBooks.reducer +}; export const metaReducers: MetaReducer[] = [];