diff --git a/src/packages/member/component/signup/signup.component.html b/src/packages/member/component/signup/signup.component.html index ec48f85..db98472 100644 --- a/src/packages/member/component/signup/signup.component.html +++ b/src/packages/member/component/signup/signup.component.html @@ -1,71 +1,78 @@
-
-
-
- -
-
- - -
- Invalid email -
-
-
-
- - -
- Invalid password -
-
-
-
- - -
- Not matched password -
-
-
+ - \ No newline at end of file +
+ diff --git a/src/packages/member/component/signup/signup.component.ts b/src/packages/member/component/signup/signup.component.ts index 05b90b0..468fece 100644 --- a/src/packages/member/component/signup/signup.component.ts +++ b/src/packages/member/component/signup/signup.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { FormGroup, FormBuilder, Validators, AbstractControl, FormControl } from '@angular/forms'; import { Member } from '../../model'; +import * as AuthStore from '../../store/signup'; +import {Store} from '@ngrx/store'; @Component({ selector: 'of-member-signup', @@ -20,7 +22,8 @@ export class SignupComponent implements OnInit { constructor( private router: Router, - private formBuilder: FormBuilder + private formBuilder: FormBuilder, + private store: Store, ) { } ngOnInit() { @@ -29,35 +32,47 @@ export class SignupComponent implements OnInit { initForm() { this.signupForm = this.formBuilder.group({ - 'email': ['', [ - Validators.required, - Validators.email - ] + 'email': [ + 'geekhot@hotmail.co.kr', + [ + Validators.required, + Validators.email + ] ], - 'password': ['', [ - Validators.required, - Validators.pattern('^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$'), - Validators.minLength(6), - Validators.maxLength(25), - ] + 'password': [ + '!@#$Qwer1234', + [ + Validators.required, + Validators.pattern('^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{6,}$'), + Validators.minLength(6), + Validators.maxLength(25), + ] ], - 'pwConfirm': ['', [ - Validators.compose([ + 'pwConfirm': [ + '!@#$Qwer1234', + [ + Validators.compose([ Validators.required, this.pwMatchValidator ]) - ] + ] ], - 'name': ['', [ - Validators.required - ] + 'name': [ + 'Park', + [ + Validators.required + ] ], - 'phone': ['', [ - Validators.required - ] + 'phone': [ + '010-3040-0303', + [ + Validators.required + ] ], - 'company': ['', [ - Validators.required - ] + 'company': [ + 'atgame', + [ + Validators.required + ] ], }); this.email = this.signupForm.controls['email']; @@ -79,14 +94,16 @@ export class SignupComponent implements OnInit { } signup() { - const signinValue = Object.assign({}, this.signupForm.value); + const signupValue = Object.assign({}, this.signupForm.value); + const password = signupValue.password; const member: Member = { - email: signinValue.email, - password: signinValue.password, - name: signinValue.name, - phone: signinValue.phone, - companyName: signinValue.company, + email: signupValue.email, + password: signupValue.password, + name: signupValue.name, + phone: signupValue.phone, + companyName: signupValue.company, }; + this.store.dispatch(new AuthStore.Signup({member, password})); console.log(member); } diff --git a/src/packages/member/service/member.service.ts b/src/packages/member/service/member.service.ts index 1cd1ab0..5778e97 100644 --- a/src/packages/member/service/member.service.ts +++ b/src/packages/member/service/member.service.ts @@ -34,10 +34,11 @@ export class MemberService { }); } - public signup(member: Member): Observable { + public signup(member: Member, password: string): Observable { return this.restService.request('post', '/account/signup', { body: { member: member, + password: password, }, }); } diff --git a/src/packages/member/store/signup/signup.action.ts b/src/packages/member/store/signup/signup.action.ts index 9c68f2f..ffd1358 100644 --- a/src/packages/member/store/signup/signup.action.ts +++ b/src/packages/member/store/signup/signup.action.ts @@ -13,7 +13,7 @@ export enum ActionType { export class Signup implements Action { readonly type = ActionType.Signup; - constructor(public payload: Member) {} + constructor(public payload: {member: Member, password: string}) {} } export class SignupSuccess implements Action { diff --git a/src/packages/member/store/signup/signup.effect.ts b/src/packages/member/store/signup/signup.effect.ts index 1d5f201..06eed9a 100644 --- a/src/packages/member/store/signup/signup.effect.ts +++ b/src/packages/member/store/signup/signup.effect.ts @@ -36,9 +36,9 @@ export class Effects { signup$: Observable = this.actions$ .ofType(ActionType.Signup) .map((action: Signup) => action.payload) - .exhaustMap(member => + .exhaustMap(payload => this.memberService - .signup(member) + .signup(payload.member, payload.password) .map(_member => new SignupSuccess(_member)) .catch(error => of(new SignupFailure(error))) );