diff --git a/src/app/shared/state/auth.reducer.ts b/src/app/shared/state/auth.reducer.ts index e999aef..7c5b6d4 100644 --- a/src/app/shared/state/auth.reducer.ts +++ b/src/app/shared/state/auth.reducer.ts @@ -35,3 +35,7 @@ export const authReducer = createReducer( export function reducer(state: State | undefined, action: Action) { return authReducer(state, action); } + +export const selectGettingStatus = (state: State) => state.gettingStatus; +export const selectUser = (state: State) => state.user; +export const selectError = (state: State) => state.error; diff --git a/src/app/shared/state/index.ts b/src/app/shared/state/index.ts index 9cc57fe..0ccf4b6 100644 --- a/src/app/shared/state/index.ts +++ b/src/app/shared/state/index.ts @@ -3,15 +3,34 @@ import * as fromAuth from "./auth.reducer"; import * as fromBooks from "./books.reducer"; export interface State { + auth: fromAuth.State; books: fromBooks.State; } export const reducers: ActionReducerMap = { + auth: fromAuth.reducer, books: fromBooks.reducer }; export const metaReducers: MetaReducer[] = []; +/** + * Auth Selectors + */ +export const selectAuthState = (state: State) => state.auth; +export const selectGettingAuthStatus = createSelector( + selectAuthState, + fromAuth.selectGettingStatus +); +export const selectAuthUser = createSelector( + selectAuthState, + fromAuth.selectUser +); +export const selectAuthError = createSelector( + selectAuthState, + fromAuth.selectError +); + /** * Books Selectors */