diff --git a/@overflow/member/component/member-modify-password.component.ts b/@overflow/member/component/member-modify-password.component.ts index 0b65ad6..f865689 100644 --- a/@overflow/member/component/member-modify-password.component.ts +++ b/@overflow/member/component/member-modify-password.component.ts @@ -7,7 +7,7 @@ import { FormGroup, FormBuilder, Validators } from '@angular/forms'; }) export class MemberModifyPasswordComponent implements OnInit { @Input() token: string; - @Output() resetPassword = new EventEmitter<{token: string, password: string, confirmPassword: string}>(); + @Output() modifyPassword = new EventEmitter<{token: string, password: string, confirmPassword: string}>(); @Output() signin = new EventEmitter(); modifyPasswordForm: FormGroup; @@ -46,6 +46,6 @@ export class MemberModifyPasswordComponent implements OnInit { modifyPasswordFormSubmit() { const formValue = Object.assign({}, this.modifyPasswordForm.value); - this.resetPassword.emit({token: this.token, password: formValue.pw, confirmPassword: formValue.confirmPw}); + this.modifyPassword.emit({token: this.token, password: formValue.pw, confirmPassword: formValue.confirmPw}); } } diff --git a/@overflow/member/component/member-profile.component.html b/@overflow/member/component/member-profile.component.html index a530a3b..68a6293 100644 --- a/@overflow/member/component/member-profile.component.html +++ b/@overflow/member/component/member-profile.component.html @@ -1,4 +1,4 @@ -
+
@@ -13,25 +13,25 @@
- +
- +
- +
- +
diff --git a/@overflow/member/component/member-profile.component.ts b/@overflow/member/component/member-profile.component.ts index 7d20b76..6ee7dd9 100644 --- a/@overflow/member/component/member-profile.component.ts +++ b/@overflow/member/component/member-profile.component.ts @@ -1,13 +1,14 @@ import { Component, OnInit, OnDestroy, Input, Output, EventEmitter } from '@angular/core'; import { Member } from '@overflow/commons-typescript/model/member'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { DomainMember } from '@overflow/commons-typescript/model/domain'; @Component({ selector: 'of-member-profile', templateUrl: './member-profile.component.html', }) export class MemberProfileComponent implements OnInit, OnDestroy { - @Input() member: Member; + @Input() domainMember: DomainMember; @Output() modify = new EventEmitter(); form: FormGroup; @@ -27,21 +28,21 @@ export class MemberProfileComponent implements OnInit, OnDestroy { initForm() { this.form = this.formBuilder.group({ - 'email': [this.member.email, + 'email': ['', [ Validators.required, Validators.email ]], - 'name': [this.member.name, []], - 'companyName': [this.member.companyName, []], - 'phone': [this.member.phone, []], + 'name': ['', []], + 'companyName': ['', []], + 'phone': ['', []], }); } - onSubmit() { + profileFormSubmit() { const formValue = Object.assign({}, this.form.value); const member: Member = { - email: this.member.email, + email: this.domainMember.member.email, name: formValue.name, phone: formValue.phone, companyName: formValue.companyName, diff --git a/@overflow/member/component/member-signin.component.ts b/@overflow/member/component/member-signin.component.ts index 06f581b..29c1ee9 100644 --- a/@overflow/member/component/member-signin.component.ts +++ b/@overflow/member/component/member-signin.component.ts @@ -11,10 +11,9 @@ export class MemberSigninComponent implements OnInit { @Input() signinError: string; @Output() resetPassword = new EventEmitter(); @Output() signup = new EventEmitter(); - @Output() signin = new EventEmitter<{email: string, password: string, returnURL: string}>(); + @Output() signin = new EventEmitter<{email: string, password: string}>(); errorMessage: string | null; - returnURL: string; signinForm: FormGroup; formErrors = { @@ -53,7 +52,6 @@ export class MemberSigninComponent implements OnInit { signinFormSubmit() { const formValue = Object.assign({}, this.signinForm.value); - formValue.returnURL = this.returnURL; this.signin.emit(formValue); } diff --git a/@overflow/member/container/member-modify-password-container.component.html b/@overflow/member/container/member-modify-password-container.component.html index 54af963..95d23bd 100644 --- a/@overflow/member/container/member-modify-password-container.component.html +++ b/@overflow/member/container/member-modify-password-container.component.html @@ -1,72 +1,6 @@ -
-
- - - - - - - -
- -
\ No newline at end of file + + diff --git a/@overflow/member/container/member-modify-password-container.component.ts b/@overflow/member/container/member-modify-password-container.component.ts index 0da3d8f..baa4a69 100644 --- a/@overflow/member/container/member-modify-password-container.component.ts +++ b/@overflow/member/container/member-modify-password-container.component.ts @@ -1,63 +1,28 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { FormGroup, FormBuilder, Validators } from '@angular/forms'; -import * as ModifyPasswordStore from '../../store/reset-password'; -import {select, Store} from '@ngrx/store'; -import { ResetPasswordSelector } from '../../store'; +import { FormGroup, FormBuilder, Validators } from '@angular/forms'; +import { select, Store } from '@ngrx/store'; +import { Observable } from 'rxjs'; + +import * as MemberEntityStore from '../store/entity/member'; @Component({ selector: 'of-member-modify-password-container', - templateUrl: './modify-password-container.component.html', + templateUrl: './member-modify-password-container.component.html', }) export class MemberModifyPasswordContainerComponent implements OnInit { - - modifyPwForm: FormGroup; - tokenURL: string; - formErrors = { - 'pw': '', - 'confirmPw': '' - }; + @Input() token: string; + @Output() signin = new EventEmitter(); constructor( - private router: Router, - private activatedRoute: ActivatedRoute, - private formBuilder: FormBuilder, - private modifyPasswordStore: Store, + private store: Store, ) { } ngOnInit() { - this.tokenURL = this.activatedRoute.snapshot.queryParams['token']; - console.log(this.tokenURL); - this.initForm(); } - initForm() { - this.modifyPwForm = this.formBuilder.group({ - 'pw': [ - '', - [ - // Validators.required, - ] - ], - 'confirmPw': [ - '', - [ - // Validators.pattern('^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$'), - // Validators.minLength(6), - // Validators.maxLength(25) - ] - ], - }); - + modifyPassword(info: {token: string, password: string, confirmPassword: string}) { + this.store.dispatch(new MemberEntityStore.ModifyPassword(info)); } - modifyPw() { - const modifyPwValue = Object.assign({}, this.modifyPwForm.value); - const m = {token: this.tokenURL, pw: modifyPwValue.pw, confirmPw: modifyPwValue.confirmPw}; - this.modifyPasswordStore.dispatch(new ModifyPasswordStore.ModifyPassword(m)); - } - - signinBtn() { - this.router.navigateByUrl('/auth/signin'); - } } diff --git a/@overflow/member/container/member-profile-container.component.html b/@overflow/member/container/member-profile-container.component.html index 4613f90..f53704b 100644 --- a/@overflow/member/container/member-profile-container.component.html +++ b/@overflow/member/container/member-profile-container.component.html @@ -1,47 +1,5 @@ -
-
-
-
-
- -
- -
-
+ -
-
-
- - - - -
-
- - - - -
-
- - - - -
-
- - - - -
-
-
-
- -
-
-
+ \ No newline at end of file diff --git a/@overflow/member/container/member-profile-container.component.ts b/@overflow/member/container/member-profile-container.component.ts index a805ca7..099c5d7 100644 --- a/@overflow/member/container/member-profile-container.component.ts +++ b/@overflow/member/container/member-profile-container.component.ts @@ -1,92 +1,38 @@ import { Component, OnInit, OnDestroy } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -// import { PagesComponent } from 'app/pages/pages.component'; - -import * as AuthStore from '../../store/auth'; -import * as ModifyStore from '../../store/modify'; - -import { Member } from '@overflow/commons-typescript/model/member'; -import { AuthSelector } from '../../store'; import { Store, select } from '@ngrx/store'; -import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { ModifySelector } from '../../store'; -import { RPCClientError } from '@loafer/ng-rpc'; +import { Observable } from 'rxjs'; +import { RPCClientError } from '@loafer/ng-rpc'; +import { Member } from '@overflow/commons-typescript/model/member'; + +import { AuthContainerSelector } from '@overflow/shared/auth/store'; +import { DomainMember } from '@overflow/commons-typescript/model/domain'; + +import * as MemberEntityStore from '../store/entity/member'; @Component({ selector: 'of-member-profile-container', templateUrl: './member-profile-container.component.html', }) export class MemberProfileContainerComponent implements OnInit, OnDestroy { - - member: Member; - modifyForm: FormGroup; - - modifiedMember$ = this.modifyStore.pipe(select(ModifySelector.select('member'))); + domainMember$: Observable; constructor( - // public app: PagesComponent, - private activatedRoute: ActivatedRoute, - private router: Router, - private store: Store, - private formBuilder: FormBuilder, - private modifyStore: Store + private store: Store, ) { } ngOnInit() { - this.store.select(AuthSelector.select('member')).subscribe( - (member: Member) => { - this.member = member; - }, - (error) => { - console.log(error); - } - ); - this.initForm(); + this.domainMember$ = this.store.pipe(select(AuthContainerSelector.selectDomainMember)); } ngOnDestroy() { } - initForm() { - this.modifyForm = this.formBuilder.group({ - 'email': [this.member.email, - [ - Validators.required, - Validators.email - ]], - 'name': [this.member.name, []], - 'companyName': [this.member.companyName, []], - 'phone': [this.member.phone, []], - }); - } - - modifyProfile() { - const modifyValue = Object.assign({}, this.modifyForm.value); - const member: Member = { - email: this.member.email, - name: modifyValue.name, - phone: modifyValue.phone, - companyName: modifyValue.companyName, - }; - this.modifyStore.dispatch(new ModifyStore.Modify(member)); - - const modifiedMemberSubscription$ = this.modifiedMember$.subscribe( - (m: Member) => { - if (m) { - console.log(m); - } - - if (modifiedMemberSubscription$) { - modifiedMemberSubscription$.unsubscribe(); - } - }, - (error: RPCClientError) => { - console.log(error.response.message); - } - ); + modify(member: Member) { + this.store.dispatch(new MemberEntityStore.Modify(member)); } } diff --git a/@overflow/member/container/member-reset-password-container.component.html b/@overflow/member/container/member-reset-password-container.component.html index 0c4fdcd..00ae5d0 100644 --- a/@overflow/member/container/member-reset-password-container.component.html +++ b/@overflow/member/container/member-reset-password-container.component.html @@ -1 +1,4 @@ - + + diff --git a/@overflow/member/container/member-reset-password-container.component.ts b/@overflow/member/container/member-reset-password-container.component.ts index 68ded9c..964d1d3 100644 --- a/@overflow/member/container/member-reset-password-container.component.ts +++ b/@overflow/member/container/member-reset-password-container.component.ts @@ -1,58 +1,24 @@ import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { FormGroup, FormBuilder, Validators } from '@angular/forms'; -import * as ResetPasswordStore from '../../store/reset-password'; import {select, Store} from '@ngrx/store'; -import { ResetPasswordSelector } from '../../store'; import {RPCClientError} from '@loafer/ng-rpc'; -import {Member} from '@overflow/commons-typescript/model/member/index'; + +import * as MemberEntityStore from '../store/entity/member'; @Component({ selector: 'of-member-reset-password-container', - templateUrl: './reset-password-container.component.html', + templateUrl: './member-reset-password-container.component.html', }) export class MemberResetPasswordContainerComponent implements OnInit { - - resetPassword$ = this.resetPasswordStore.pipe(select(ResetPasswordSelector.select('member'))); - - resetPassword: FormGroup; - formErrors = { - 'email': '' - }; - constructor( - private resetPasswordStore: Store, - private router: Router, - private formBuilder: FormBuilder) { } + private store: Store, + ) { } ngOnInit() { - this.resetPassword = this.formBuilder.group({ - 'email': ['', [ - Validators.required, - Validators.email - ] - ] - }); } - sendResetPassword() { - const emailValue = Object.assign({}, this.resetPassword.value); - console.log(emailValue.email); - this.resetPasswordStore.dispatch(new ResetPasswordStore.ResetPassword(emailValue.email)); - - const resetPasswordSubscription$ = this.resetPassword$.subscribe( - (m: Member) => { - if (m) { - console.log(m); - } - - if (resetPasswordSubscription$) { - resetPasswordSubscription$.unsubscribe(); - } - }, - (error: RPCClientError) => { - console.log(error.response.message); - } - ); + resetPassword(email: string) { + this.store.dispatch(new MemberEntityStore.ResetPassword(email)); } } diff --git a/@overflow/member/container/member-signin-container.component.ts b/@overflow/member/container/member-signin-container.component.ts index 8f9355a..4319483 100644 --- a/@overflow/member/container/member-signin-container.component.ts +++ b/@overflow/member/container/member-signin-container.component.ts @@ -1,92 +1,33 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Input } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { FormGroup, FormBuilder, Validators } from '@angular/forms'; import { Store, select } from '@ngrx/store'; +import { Observable } from 'rxjs'; -import * as AuthStore from '../store/auth'; -import { AuthSelector } from '../store'; +import { MemberSigninContainerSelector } from '../store'; + +import * as MemberEntityStore from '../store/entity/member'; @Component({ selector: 'of-member-signin-container', templateUrl: './member-signin-container.component.html', }) export class MemberSigninContainerComponent implements OnInit { - pending$ = this.store.pipe(select(AuthSelector.select('pending'))); - error$ = this.store.pipe(select(AuthSelector.select('error'))); - - errorMessage: string | null; - returnURL: string; - - signinForm: FormGroup; - formErrors = { - 'email': '', - 'password': '' - }; + @Input() returnURL: string; + pending$: Observable; + error$: Observable; constructor( - private activatedRoute: ActivatedRoute, - private router: Router, - private store: Store, - private formBuilder: FormBuilder, + private store: Store, ) { } ngOnInit() { - this.initForm(); - - this.returnURL = this.activatedRoute.snapshot.queryParams['returnURL'] || '/'; - - this.pending$.subscribe((pending: boolean) => { - if (pending) { - this.signinForm.disable(); - } else { - this.signinForm.enable(); - } - }); - - this.error$.subscribe((error) => { - if (error) { - this.errorMessage = error.exception; - } else { - this.errorMessage = null; - } - }); + this.pending$ = this.store.pipe(select(MemberSigninContainerSelector.selectPending)); + this.error$ = this.store.pipe(select(MemberSigninContainerSelector.selectError)); } - initForm() { - this.signinForm = this.formBuilder.group({ - 'email': [ - '', - [ - Validators.required, - Validators.email - ] - ], - 'password': [ - '', - [ - Validators.pattern('^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$'), - Validators.minLength(6), - Validators.maxLength(25) - ] - ], - }); - + onSignin(info: {email: string, password: string}) { + this.store.dispatch(new MemberEntityStore.Signin({...info, returnURL: this.returnURL})); } - - resetPasswordBtnClick() { - this.router.navigateByUrl('/auth/reset-password'); - } - - signupBtnClick() { - this.router.navigateByUrl('/auth/signup'); - } - signin() { - const signinValue = Object.assign({}, this.signinForm.value); - signinValue.returnURL = this.returnURL; - - this.store.dispatch(new AuthStore.Signin(signinValue)); - console.log('signin component signin fnc'); - } - } diff --git a/@overflow/member/container/member-signup-container.component.ts b/@overflow/member/container/member-signup-container.component.ts index 04e13cc..2b88916 100644 --- a/@overflow/member/container/member-signup-container.component.ts +++ b/@overflow/member/container/member-signup-container.component.ts @@ -4,9 +4,10 @@ import { OnInit, } from '@angular/core'; import { Member } from '@overflow/commons-typescript/model/member'; -import * as AuthStore from '../store/signup'; import { Store } from '@ngrx/store'; +import * as MemberEntityStore from '../store/entity/member'; + @Component({ selector: 'of-member-signup-container', templateUrl: './member-signup-container.component.html', @@ -14,7 +15,7 @@ import { Store } from '@ngrx/store'; export class MemberSignupContainerComponent implements OnInit, OnDestroy { constructor( - private store: Store, + private store: Store, ) { } ngOnInit() { @@ -24,6 +25,6 @@ export class MemberSignupContainerComponent implements OnInit, OnDestroy { } onSignup(info: {member: Member, password: string}) { - this.store.dispatch(new AuthStore.Signup(info)); + this.store.dispatch(new MemberEntityStore.Signup(info)); } } diff --git a/@overflow/noauth-probe/subscriber/noauth-probe.subscriber.ts b/@overflow/noauth-probe/subscriber/noauth-probe.subscriber.ts index 7737115..a499251 100644 --- a/@overflow/noauth-probe/subscriber/noauth-probe.subscriber.ts +++ b/@overflow/noauth-probe/subscriber/noauth-probe.subscriber.ts @@ -14,7 +14,7 @@ import { export class NoAuthProbeSubscriber { public constructor( - private store: Store, + private store: Store, private loggerService: LoggerService, ) { }