member_webapp/@overflow/member/container/member-totp-container.component.ts
crusader 41597d406d ing
2018-05-28 20:25:53 +09:00

41 lines
1.2 KiB
TypeScript

import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { Member, MemberTotp } from '@overflow/commons-typescript/model/member';
import { Observable } from 'rxjs';
import { DomainMember } from '@overflow/commons-typescript/model/domain';
import * as TotpEntityStore from '../store/entity/member-totp';
import { AuthContainerSelector } from '@overflow/shared/auth/store';
@Component({
selector: 'of-member-totp-container',
templateUrl: './member-totp-container.component.html',
})
export class MemberTotpContainerComponent implements OnInit {
domainMember$: Observable<DomainMember>;
totp$: Observable<MemberTotp[]>;
lists = [];
constructor(
private activatedRoute: ActivatedRoute,
private router: Router,
private store: Store<any>,
) { }
ngOnInit() {
this.domainMember$ = this.store.select(AuthContainerSelector.selectDomainMember);
}
regist(info: {member: Member, code: string, secretCode: string}) {
const secretCode = 'X6AWAK573M5372NM';
this.store.dispatch(new TotpEntityStore.Regist(info));
}
create(member: Member) {
this.store.dispatch(new TotpEntityStore.CreateTotp(member));
}
}