member_webapp/@overflow/member/container/member-reset-password-container.component.ts

47 lines
1.3 KiB
TypeScript
Raw Normal View History

2018-05-30 07:44:21 +00:00
import {
Component, EventEmitter,
OnInit,
Output
} from '@angular/core';
2018-05-28 10:28:26 +00:00
import {select, Store} from '@ngrx/store';
2018-05-28 11:16:00 +00:00
import * as MemberEntityStore from '../store/entity/member';
2018-05-30 07:44:21 +00:00
import { Observable } from 'rxjs';
import { Member } from '@overflow/commons-typescript/model/member';
import { MemberResetPasswordContainerSelector } from '../store';
2018-05-28 10:28:26 +00:00
@Component({
2018-05-28 10:46:47 +00:00
selector: 'of-member-reset-password-container',
2018-05-28 11:16:00 +00:00
templateUrl: './member-reset-password-container.component.html',
2018-05-28 10:28:26 +00:00
})
export class MemberResetPasswordContainerComponent implements OnInit {
2018-05-30 07:44:21 +00:00
@Output() signin = new EventEmitter();
@Output() signup = new EventEmitter();
member$: Observable<Member>;
pending$: Observable<boolean>;
error$: Observable<any>;
2018-05-28 10:28:26 +00:00
constructor(
2018-05-28 11:16:00 +00:00
private store: Store<any>,
) { }
2018-05-28 10:28:26 +00:00
ngOnInit() {
2018-05-30 07:44:21 +00:00
this.member$ = this.store.pipe(select(MemberResetPasswordContainerSelector.selectMember));
this.pending$ = this.store.pipe(select(MemberResetPasswordContainerSelector.selectPending));
this.error$ = this.store.pipe(select(MemberResetPasswordContainerSelector.selectError));
2018-05-28 10:28:26 +00:00
}
2018-05-28 11:16:00 +00:00
resetPassword(email: string) {
this.store.dispatch(new MemberEntityStore.ResetPassword(email));
2018-05-28 10:28:26 +00:00
}
2018-05-30 07:44:21 +00:00
onSignin() {
this.signin.emit();
}
onSignup() {
this.signup.emit();
}
2018-05-28 10:28:26 +00:00
}