import { Component, OnInit} from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { Store } from '@ngrx/store'; import * as TotpStore from '../store/entity/member-totp'; import { AuthSelector } from '../store/entity/member'; import { Member, MemberTotp } from '@overflow/commons-typescript/model/member'; import {Observable} from 'rxjs'; @Component({ selector: 'of-member-totp-container', templateUrl: './member-totp-container.component.html', }) export class MemberTotpContainerComponent implements OnInit { member: Member; totp$: Observable; lists = []; constructor(private activatedRoute: ActivatedRoute, private router: Router, private store: Store, ) { } ngOnInit() { this.store.select(AuthSelector.select('member')).subscribe( (member: Member) => { this.member = member; }, (error) => { console.log(error); } ); } onTotpRegist(obj: any) { const secretCode = 'X6AWAK573M5372NM'; this.store.dispatch(new TotpStore.Regist({ member: this.member, secretCode: obj.secretCode, code: obj.code })); // this.store.select(AuthSelector.select('memberTotp')).subscribe( // (memberTotp: MemberTotp) => { // // }, // (error) => { // console.log(error); // } // ); } onTotpCreate() { this.store.dispatch(new TotpStore.CreateTotp(this.member)); } }