This commit is contained in:
geek 2018-05-29 20:42:39 +09:00
parent 8f6bae5586
commit ac08c59512
8 changed files with 20 additions and 42 deletions

View File

@ -17,20 +17,7 @@
<of-member-policy (close)="policyDisplay = false"></of-member-policy>
</p-dialog>
<p-dialog
header="Membership is welcome."
[modal]="true"
[width]="800"
[(visible)]="signupComplete"
[showHeader]="true"
[closeOnEscape]="false"
(onHide)="closeSignup()">
<div>Membership is welcome. </div>
</p-dialog>
<div class="ui-g">
<div class="ui-g" *ngIf="!member">
<div class="ui-g-12 ui-md-9 ui-lg-7">
<form [formGroup]="signupForm" (ngSubmit)="signupFormSubmit()">
<table class="login-table">
@ -178,3 +165,8 @@
</form>
</div>
</div>
<div class="ui-g" *ngIf="member">
sdklsdlkfklsdfklsdklfskldfjk
{{member.email}}
</div>

View File

@ -14,9 +14,8 @@ import { Member } from '@overflow/commons-typescript/model/member';
})
export class MemberSignupComponent implements OnInit, OnDestroy {
@Output() signup = new EventEmitter<{member: Member, password: string}>();
@Output() doneSignup = new EventEmitter();
@Input() signupComplete;
@Input() member;
signupForm: FormGroup;
email: AbstractControl;
@ -134,10 +133,6 @@ export class MemberSignupComponent implements OnInit, OnDestroy {
this.policyDisplay = true;
}
closeSignup() {
this.doneSignup.emit();
}
onScriptLoad() {
console.log('Google reCAPTCHA loaded and is ready for use!');
}

View File

@ -1 +1 @@
<of-member-signup [signupComplete]="signupComplete$ | async" (signup)="onSignup($event)" (doneSignup)="onDoneSignup()" ></of-member-signup>
<of-member-signup [member]="member$ | async" (signup)="onSignup($event)" ></of-member-signup>

View File

@ -8,7 +8,7 @@ import {select, Store} from '@ngrx/store';
import * as MemberEntityStore from '../store/entity/member';
import { MemberSignupContainerSelector } from '../store';
import {Observable} from 'rxjs';
import { Observable } from 'rxjs';
@Component({
selector: 'of-member-signup-container',
@ -16,16 +16,14 @@ import {Observable} from 'rxjs';
})
export class MemberSignupContainerComponent implements OnInit, OnDestroy {
@Output() doneSignup = new EventEmitter();
signupComplete$: Observable<boolean>;
member$: Observable<Member>;
constructor(
private store: Store<any>,
) { }
ngOnInit() {
this.signupComplete$ = this.store.pipe(select(MemberSignupContainerSelector.selectSignupComplete));
this.member$ = this.store.pipe(select(MemberSignupContainerSelector.selectMember));
}
ngOnDestroy() {
@ -35,7 +33,4 @@ export class MemberSignupContainerComponent implements OnInit, OnDestroy {
this.store.dispatch(new MemberEntityStore.Signup(info));
}
onDoneSignup() {
this.doneSignup.emit();
}
}

View File

@ -12,7 +12,7 @@ export function reducer(state = initialState, action: Actions): State {
switch (action.type) {
case ActionType.Signup: {
return {
signupComplete: false,
member: null,
pending: true,
error: null,
};
@ -20,7 +20,7 @@ export function reducer(state = initialState, action: Actions): State {
case ActionType.SignupSuccess: {
return {
signupComplete: true,
member: action.payload,
pending: false,
error: null,
};
@ -28,7 +28,7 @@ export function reducer(state = initialState, action: Actions): State {
case ActionType.SignupFailure: {
return {
signupComplete: false,
member: null,
pending: false,
error: action.payload,
};

View File

@ -1,22 +1,23 @@
import { Selector, createSelector } from '@ngrx/store';
import { RESTClientError } from '@loafer/ng-rest';
import { Member } from '@overflow/commons-typescript/model/member';
export interface State {
signupComplete: boolean;
member: Member;
pending: boolean;
error: RESTClientError;
}
export const initialState: State = {
signupComplete: false,
member: null,
pending: false,
error: null,
};
export function getSelectors(selector: Selector<any, State>) {
return {
selectSignupComplete: createSelector(selector, (state: State) => state.signupComplete),
selectMember: createSelector(selector, (state: State) => state.member),
selectPending: createSelector(selector, (state: State) => state.pending),
selectError: createSelector(selector, (state: State) => state.error),
};

View File

@ -1,6 +1,6 @@
<div class="ui-g">
<div class="ui-g-12 ui-md-9 ui-lg-7">
<of-member-signup-container (doneSignup)="signupComplete()"></of-member-signup-container>
<of-member-signup-container ></of-member-signup-container>
</div>
<div class="ui-g-12 ui-md-3 ui-lg-5 login-descript">
<table class="login-table">

View File

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'of-pages-auth-signup',
@ -10,7 +10,6 @@ export class SignupPageComponent implements OnInit {
returnURL: string;
constructor(
private router: Router,
private activatedRoute: ActivatedRoute,
) { }
@ -20,8 +19,4 @@ export class SignupPageComponent implements OnInit {
initForm() {
}
signupComplete() {
this.router.navigate(['/auth/signin']);
}
}