diff --git a/src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts b/src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts index 34bfc4b..057f21f 100644 --- a/src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts +++ b/src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts @@ -15,6 +15,8 @@ import { DeleteMemberReferrerResponse, GetMemberReferrerResponse, GetMemberReferrerRequest, + GetMemberReferrerByCodeResponse, + GetMemberReferrerByCodeRequest, } from 'app/modules/proto/c2se/member_referrer_pb'; import { SUBJECT_LIST_MEMBER_REFERRERS, @@ -22,6 +24,7 @@ import { SUBJECT_UPDATE_MEMBER_REFERRER, SUBJECT_DELETE_MEMBER_REFERRER, SUBJECT_GET_MEMBER_REFERRER, + SUBJECT_GET_MEMBER_REFERRER_BY_CODE, } from 'app/modules/proto/c2se/backend/member_referrer_pb'; @Injectable({ @@ -113,6 +116,33 @@ export class MemberReferrerService { }); } + getMemberReferrerByCode( + code: string + ): Promise { + return new Promise( + (resolve, reject) => { + let req = new GetMemberReferrerByCodeRequest(); + + req.setCode(code); + + this.__natsService + .request( + SUBJECT_GET_MEMBER_REFERRER_BY_CODE, + req.serializeBinary(), + GetMemberReferrerByCodeResponse.deserializeBinary + ) + .then((result) => { + console.log('success', result, result.getMemberReferrer()); + return resolve(result); + }) + .catch((e: Error) => { + console.log('failed', e); + return reject(e); + }); + } + ); + } + updateMemberReferrer(): Promise { return new Promise( (resolve, reject) => { diff --git a/src/app/modules/user/main/compose/sign-up-compose.component.html b/src/app/modules/user/main/compose/sign-up-compose.component.html index a4f5f0f..3277942 100644 --- a/src/app/modules/user/main/compose/sign-up-compose.component.html +++ b/src/app/modules/user/main/compose/sign-up-compose.component.html @@ -47,6 +47,15 @@ > 추천인 코드는 필수 입력입니다. + + 추천인 코드는 필수 입력입니다. + diff --git a/src/app/modules/user/main/compose/sign-up-compose.component.ts b/src/app/modules/user/main/compose/sign-up-compose.component.ts index e5c26bc..0df472c 100644 --- a/src/app/modules/user/main/compose/sign-up-compose.component.ts +++ b/src/app/modules/user/main/compose/sign-up-compose.component.ts @@ -163,10 +163,14 @@ export class SignUpComposeComponent implements OnInit { } __checkReferrerCode(event: FocusEvent): void { - // const code = this.signupComposeForm.get('referalCode')?.value; - // this._memberReferrerService.getMemberReferrer( - // '6df060ad-3b30-4c6c-8e9f-9d3e30974157' - // ); + const code = this.signupComposeForm.get('referalCode')?.value; + this._memberReferrerService.getMemberReferrerByCode(code).then((result) => { + if (!result) { + this.signupComposeForm + ?.get('referalCode') + ?.setErrors({ notExistReferalCode: true }); + } + }); } __checkUsernameDuplicate(event: FocusEvent): void {