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

39 lines
1.3 KiB
TypeScript
Raw Normal View History

2018-05-28 11:16:00 +00:00
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
2018-05-30 07:44:21 +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 { MemberModifyPasswordContainerSelector } from '../store';
import { Observable } from 'rxjs';
import { Member } from '@overflow/commons-typescript/model/member';
2018-05-28 10:28:26 +00:00
@Component({
2018-05-28 10:46:47 +00:00
selector: 'of-member-modify-password-container',
2018-05-28 11:16:00 +00:00
templateUrl: './member-modify-password-container.component.html',
2018-05-28 10:28:26 +00:00
})
export class MemberModifyPasswordContainerComponent implements OnInit {
2018-05-28 11:16:00 +00:00
@Input() token: string;
@Output() signin = new EventEmitter();
2018-05-28 10:28:26 +00:00
2018-05-30 07:44:21 +00:00
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(MemberModifyPasswordContainerSelector.selectMember));
this.pending$ = this.store.pipe(select(MemberModifyPasswordContainerSelector.selectPending));
this.error$ = this.store.pipe(select(MemberModifyPasswordContainerSelector.selectError));
2018-05-28 10:28:26 +00:00
}
2018-05-28 11:16:00 +00:00
modifyPassword(info: {token: string, password: string, confirmPassword: string}) {
this.store.dispatch(new MemberEntityStore.ModifyPassword(info));
2018-05-28 10:28:26 +00:00
}
2018-05-30 07:44:21 +00:00
onSignin() {
this.signin.emit();
}
2018-05-28 10:28:26 +00:00
}