import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import {select, Store} from '@ngrx/store'; import * as MemberEntityStore from '../store/entity/member'; import { MemberModifyPasswordContainerSelector } from '../store'; import { Observable } from 'rxjs'; import { Member } from '@overflow/commons-typescript/model/member'; @Component({ selector: 'of-member-modify-password-container', templateUrl: './member-modify-password-container.component.html', }) export class MemberModifyPasswordContainerComponent implements OnInit { @Input() token: string; @Output() signin = new EventEmitter(); member$: Observable; pending$: Observable; error$: Observable; constructor( private store: Store, ) { } ngOnInit() { this.member$ = this.store.pipe(select(MemberModifyPasswordContainerSelector.selectMember)); this.pending$ = this.store.pipe(select(MemberModifyPasswordContainerSelector.selectPending)); this.error$ = this.store.pipe(select(MemberModifyPasswordContainerSelector.selectError)); } modifyPassword(info: {token: string, password: string, confirmPassword: string}) { this.store.dispatch(new MemberEntityStore.ModifyPassword(info)); } onSignin() { this.signin.emit(); } }