import { Component, EventEmitter, OnInit, Output } from '@angular/core'; import {select, Store} from '@ngrx/store'; import * as MemberEntityStore from '../store/entity/member'; import { Observable } from 'rxjs'; import { Member } from '@overflow/commons-typescript/model/member'; import { MemberResetPasswordContainerSelector } from '../store'; @Component({ selector: 'of-member-reset-password-container', templateUrl: './member-reset-password-container.component.html', }) export class MemberResetPasswordContainerComponent implements OnInit { @Output() signin = new EventEmitter(); @Output() signup = new EventEmitter(); member$: Observable; pending$: Observable; error$: Observable; constructor( private store: Store, ) { } ngOnInit() { this.member$ = this.store.pipe(select(MemberResetPasswordContainerSelector.selectMember)); this.pending$ = this.store.pipe(select(MemberResetPasswordContainerSelector.selectPending)); this.error$ = this.store.pipe(select(MemberResetPasswordContainerSelector.selectError)); } resetPassword(email: string) { this.store.dispatch(new MemberEntityStore.ResetPassword(email)); } onSignin() { this.signin.emit(); } onSignup() { this.signup.emit(); } }