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