member_webapp/@overflow/member/container/member-signup-container.component.ts
2018-05-29 18:32:22 +09:00

42 lines
1012 B
TypeScript

import {
Component, EventEmitter,
OnDestroy,
OnInit, Output,
} from '@angular/core';
import { Member } from '@overflow/commons-typescript/model/member';
import {select, Store} from '@ngrx/store';
import * as MemberEntityStore from '../store/entity/member';
import { MemberSignupContainerSelector } from '../store';
import {Observable} from 'rxjs';
@Component({
selector: 'of-member-signup-container',
templateUrl: './member-signup-container.component.html',
})
export class MemberSignupContainerComponent implements OnInit, OnDestroy {
@Output() doneSignup = new EventEmitter();
signupComplete$: Observable<boolean>;
constructor(
private store: Store<any>,
) { }
ngOnInit() {
this.signupComplete$ = this.store.pipe(select(MemberSignupContainerSelector.selectSignupComplete));
}
ngOnDestroy() {
}
onSignup(info: {member: Member, password: string}) {
this.store.dispatch(new MemberEntityStore.Signup(info));
}
onDoneSignup() {
this.doneSignup.emit();
}
}