2018-05-28 11:25:53 +00:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2018-05-28 10:28:26 +00:00
|
|
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
|
|
import { Store } from '@ngrx/store';
|
|
|
|
|
|
|
|
import { Member, MemberTotp } from '@overflow/commons-typescript/model/member';
|
2018-05-28 11:25:53 +00:00
|
|
|
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';
|
2018-05-28 10:28:26 +00:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'of-member-totp-container',
|
|
|
|
templateUrl: './member-totp-container.component.html',
|
|
|
|
})
|
|
|
|
export class MemberTotpContainerComponent implements OnInit {
|
2018-05-28 11:25:53 +00:00
|
|
|
domainMember$: Observable<DomainMember>;
|
2018-05-28 10:28:26 +00:00
|
|
|
totp$: Observable<MemberTotp[]>;
|
|
|
|
lists = [];
|
|
|
|
|
2018-05-28 11:25:53 +00:00
|
|
|
constructor(
|
|
|
|
private activatedRoute: ActivatedRoute,
|
|
|
|
private router: Router,
|
|
|
|
private store: Store<any>,
|
|
|
|
) { }
|
2018-05-28 10:28:26 +00:00
|
|
|
|
|
|
|
ngOnInit() {
|
2018-05-28 11:25:53 +00:00
|
|
|
this.domainMember$ = this.store.select(AuthContainerSelector.selectDomainMember);
|
2018-05-28 10:28:26 +00:00
|
|
|
}
|
|
|
|
|
2018-05-28 11:25:53 +00:00
|
|
|
regist(info: {member: Member, code: string, secretCode: string}) {
|
2018-05-28 10:28:26 +00:00
|
|
|
const secretCode = 'X6AWAK573M5372NM';
|
|
|
|
|
2018-05-28 11:25:53 +00:00
|
|
|
this.store.dispatch(new TotpEntityStore.Regist(info));
|
2018-05-28 10:28:26 +00:00
|
|
|
}
|
|
|
|
|
2018-05-28 11:25:53 +00:00
|
|
|
create(member: Member) {
|
|
|
|
this.store.dispatch(new TotpEntityStore.CreateTotp(member));
|
2018-05-28 10:28:26 +00:00
|
|
|
}
|
|
|
|
}
|