member_webapp/@overflow/member/container/member-reset-password-container.component.ts
2018-05-30 16:44:21 +09:00

47 lines
1.3 KiB
TypeScript

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