Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/app/shared/state/auth.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
19 changes: 19 additions & 0 deletions src/app/shared/state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<State> = {
auth: fromAuth.reducer,
books: fromBooks.reducer
};

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

/**
* 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
*/
Expand Down