This commit is contained in:
geek 2018-06-01 20:31:46 +09:00
parent fd369d3519
commit 8334673ecb

View File

@ -1,16 +1,24 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { DomainMember } from '@overflow/commons-typescript/model/domain'; import { DomainMember } from '@overflow/commons-typescript/model/domain';
import { Member } from '@overflow/commons-typescript/model/member'; import { Member } from '@overflow/commons-typescript/model/member';
import {AuthSelector} from '../../shared/auth/store';
import { Observable, of } from 'rxjs';
import { Store } from '@ngrx/store';
import * as AuthStore from '@overflow/shared/auth/store/auth';
import { catchError, map, tap } from 'rxjs/operators';
@Component({ @Component({
selector: 'of-member-totp', selector: 'of-member-totp',
templateUrl: './member-totp.component.html', templateUrl: './member-totp.component.html',
}) })
export class MemberTotpComponent implements OnInit { export class MemberTotpComponent implements OnInit {
@Input() domainMember: DomainMember; domainMember: DomainMember;
@Input() totp; totp;
@Output() regist = new EventEmitter<{ member: Member, code: string, secretCode: string }>(); // @Output() regist = new EventEmitter<{ member: Member, code: string, secretCode: string }>();
@Output() create = new EventEmitter<Member>(); // @Output() create = new EventEmitter<Member>();
pending$: Observable<boolean>;
error$: Observable<any>;
selectedItem: any; selectedItem: any;
totpSettingDisplay = false; totpSettingDisplay = false;
@ -20,9 +28,16 @@ export class MemberTotpComponent implements OnInit {
lists = []; lists = [];
constructor() { } constructor(
private store: Store<any>,
) { }
ngOnInit() { ngOnInit() {
this.store.select(AuthSelector.selectDomainMember).subscribe(
(domainMember: DomainMember) => {
this.domainMember = domainMember;
}
);
this.lists = [ this.lists = [
{ id: 1, name: 'Email', value: this.domainMember.member.email, description: 'blabla', }, { id: 1, name: 'Email', value: this.domainMember.member.email, description: 'blabla', },
{ id: 2, name: 'Phone', value: this.domainMember.member.phone, description: 'blabla', }, { id: 2, name: 'Phone', value: this.domainMember.member.phone, description: 'blabla', },
@ -43,7 +58,7 @@ export class MemberTotpComponent implements OnInit {
totpInput(e) { totpInput(e) {
if (e.target.value.length >= 6) { if (e.target.value.length >= 6) {
this.regist.emit(e.target.value); // this.regist.emit(e.target.value);
} }
return; return;
} }