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; error$: Observable; constructor( private store: Store, ) { } 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})); } }