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