member_webapp/@overflow/member/container/member-signin-container.component.ts
crusader 2802c1ae17 ing
2018-05-28 20:16:00 +09:00

34 lines
1.0 KiB
TypeScript

import { Component, OnInit, Input } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { Store, select } from '@ngrx/store';
import { Observable } from 'rxjs';
import { MemberSigninContainerSelector } from '../store';
import * as MemberEntityStore from '../store/entity/member';
@Component({
selector: 'of-member-signin-container',
templateUrl: './member-signin-container.component.html',
})
export class MemberSigninContainerComponent implements OnInit {
@Input() returnURL: string;
pending$: Observable<boolean>;
error$: Observable<any>;
constructor(
private store: Store<any>,
) {
}
ngOnInit() {
this.pending$ = this.store.pipe(select(MemberSigninContainerSelector.selectPending));
this.error$ = this.store.pipe(select(MemberSigninContainerSelector.selectError));
}
onSignin(info: {email: string, password: string}) {
this.store.dispatch(new MemberEntityStore.Signin({...info, returnURL: this.returnURL}));
}
}