member_webapp/src/packages/member/store/index.ts

67 lines
1.7 KiB
TypeScript
Raw Normal View History

2018-04-06 06:59:49 +00:00
import {
createSelector,
createFeatureSelector,
} from '@ngrx/store';
import { StateSelector } from 'packages/core/ngrx/store';
import { MODULE } from '../member.constant';
import * as AuthStore from './auth';
import * as SignupStore from './signup';
2018-04-19 12:35:11 +00:00
import * as TotpStore from './totp';
2018-04-30 11:50:47 +00:00
import * as ModifyStore from './modify';
2018-05-03 10:33:19 +00:00
import * as ResetPasswordStore from './reset-password';
2018-04-06 06:59:49 +00:00
export interface State {
auth: AuthStore.State;
2018-04-30 11:50:47 +00:00
signup: SignupStore.State;
2018-04-19 12:35:11 +00:00
totp: TotpStore.State;
2018-04-30 11:50:47 +00:00
modify: ModifyStore.State;
2018-05-03 10:33:19 +00:00
resetPassword: ResetPasswordStore.State;
2018-04-06 06:59:49 +00:00
}
export const REDUCERS = {
auth: AuthStore.reducer,
signup: SignupStore.reducer,
2018-04-19 12:35:11 +00:00
totp: TotpStore.reducer,
2018-04-30 11:50:47 +00:00
modify: ModifyStore.reducer,
2018-05-03 10:33:19 +00:00
resetPassword: ResetPasswordStore.reducer,
2018-04-06 06:59:49 +00:00
};
export const EFFECTS = [
AuthStore.Effects,
SignupStore.Effects,
2018-04-19 12:35:11 +00:00
TotpStore.Effects,
2018-05-03 10:33:19 +00:00
ModifyStore.Effects,
ResetPasswordStore.Effects,
2018-04-06 06:59:49 +00:00
];
export const selectMemberState = createFeatureSelector<State>(MODULE.name);
export const AuthSelector = new StateSelector<AuthStore.State>(createSelector(
selectMemberState,
(state: State) => state.auth
));
2018-04-30 11:50:47 +00:00
export const SignupSelector = new StateSelector<SignupStore.State>(createSelector(
2018-04-06 06:59:49 +00:00
selectMemberState,
(state: State) => state.signup
));
2018-04-19 12:35:11 +00:00
export const TotpSelector = new StateSelector<TotpStore.State>(createSelector(
selectMemberState,
(state: State) => state.totp
));
2018-04-30 12:04:58 +00:00
export const ModifySelector = new StateSelector<ModifyStore.State>(createSelector(
selectMemberState,
(state: State) => state.modify
));
2018-05-03 10:33:19 +00:00
export const ResetPasswordSelector = new StateSelector<ResetPasswordStore.State>(createSelector(
selectMemberState,
(state: State) => state.resetPassword
));