Skip to content

Commit aef3c5f

Browse files
committed
04-setting-up-the-store
1 parent 9f937d4 commit aef3c5f

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/app/shared/state/books.reducer.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createReducer, on } from "@ngrx/store";
1+
import { createReducer, on, Action } from "@ngrx/store";
22
import { BookModel } from "src/app/shared/models/book.model";
33
import { BooksPageActions } from "src/app/books/actions";
44

@@ -35,3 +35,7 @@ export const booksReducer = createReducer(
3535
};
3636
})
3737
);
38+
39+
export function reducer(state: State | undefined, action: Action) {
40+
return booksReducer(state, action);
41+
}

src/app/shared/state/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import { ActionReducerMap, createSelector, MetaReducer } from "@ngrx/store";
2+
import * as fromBooks from "./books.reducer";
23

3-
export interface State {}
4+
export interface State {
5+
books: fromBooks.State;
6+
}
47

5-
export const reducers: ActionReducerMap<State> = {};
8+
export const reducers: ActionReducerMap<State> = {
9+
books: fromBooks.reducer
10+
};
611

712
export const metaReducers: MetaReducer<State>[] = [];
813

0 commit comments

Comments
 (0)