js/example-app/packages/member/store/auth.store.ts
crusader bd8104ffe2 ing
2018-03-18 00:03:13 +09:00

60 lines
1002 B
TypeScript

import { Actions } from '@ngrx/effects';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/switchMap';
import 'rxjs/add/operator/map';
import {
Store,
Action,
Effect,
ofAction,
} from '@loafer/ngrx-store';
import {
Signin,
SigninSuccess,
SigninFailure,
} from './auth.action';
import {
State,
initialState,
} from './auth.state';
import { MemberService } from '../service/member.service';
@Store(initialState)
export class AuthStore {
public constructor(
private actions$: Actions,
private memberService: MemberService,
) {
}
@Action(Signin)
signin(state: State, action: Signin) {
}
@Action(SigninSuccess)
signinSuccess(state: State, action: SigninSuccess) {
}
@Action(SigninFailure)
signinFailure(state: State, action: SigninFailure) {
}
@Effect(Signin)
signinEffect(state: State, { payload }: Signin) {
this.memberService.signin(payload.email, payload.password)
.map((result: any) => {
});
}
}