추천인코드 조회 연동

This commit is contained in:
Park Byung Eun 2022-08-20 09:50:06 +00:00
parent c1fcd18554
commit fa491c94a7
3 changed files with 47 additions and 4 deletions

View File

@ -15,6 +15,8 @@ import {
DeleteMemberReferrerResponse, DeleteMemberReferrerResponse,
GetMemberReferrerResponse, GetMemberReferrerResponse,
GetMemberReferrerRequest, GetMemberReferrerRequest,
GetMemberReferrerByCodeResponse,
GetMemberReferrerByCodeRequest,
} from 'app/modules/proto/c2se/member_referrer_pb'; } from 'app/modules/proto/c2se/member_referrer_pb';
import { import {
SUBJECT_LIST_MEMBER_REFERRERS, SUBJECT_LIST_MEMBER_REFERRERS,
@ -22,6 +24,7 @@ import {
SUBJECT_UPDATE_MEMBER_REFERRER, SUBJECT_UPDATE_MEMBER_REFERRER,
SUBJECT_DELETE_MEMBER_REFERRER, SUBJECT_DELETE_MEMBER_REFERRER,
SUBJECT_GET_MEMBER_REFERRER, SUBJECT_GET_MEMBER_REFERRER,
SUBJECT_GET_MEMBER_REFERRER_BY_CODE,
} from 'app/modules/proto/c2se/backend/member_referrer_pb'; } from 'app/modules/proto/c2se/backend/member_referrer_pb';
@Injectable({ @Injectable({
@ -113,6 +116,33 @@ export class MemberReferrerService {
}); });
} }
getMemberReferrerByCode(
code: string
): Promise<GetMemberReferrerByCodeResponse.Result> {
return new Promise<GetMemberReferrerByCodeResponse.Result>(
(resolve, reject) => {
let req = new GetMemberReferrerByCodeRequest();
req.setCode(code);
this.__natsService
.request<GetMemberReferrerByCodeResponse.Result>(
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<UpdateMemberReferrerResponse.Result> { updateMemberReferrer(): Promise<UpdateMemberReferrerResponse.Result> {
return new Promise<UpdateMemberReferrerResponse.Result>( return new Promise<UpdateMemberReferrerResponse.Result>(
(resolve, reject) => { (resolve, reject) => {

View File

@ -47,6 +47,15 @@
> >
추천인 코드는 필수 입력입니다. 추천인 코드는 필수 입력입니다.
</mat-error> </mat-error>
<mat-error
*ngIf="
signupComposeForm
?.get('referalCode')
?.hasError('notExistReferalCode')
"
>
추천인 코드는 필수 입력입니다.
</mat-error>
</mat-form-field> </mat-form-field>
<!-- Divider --> <!-- Divider -->

View File

@ -163,10 +163,14 @@ export class SignUpComposeComponent implements OnInit {
} }
__checkReferrerCode(event: FocusEvent): void { __checkReferrerCode(event: FocusEvent): void {
// const code = this.signupComposeForm.get('referalCode')?.value; const code = this.signupComposeForm.get('referalCode')?.value;
// this._memberReferrerService.getMemberReferrer( this._memberReferrerService.getMemberReferrerByCode(code).then((result) => {
// '6df060ad-3b30-4c6c-8e9f-9d3e30974157' if (!result) {
// ); this.signupComposeForm
?.get('referalCode')
?.setErrors({ notExistReferalCode: true });
}
});
} }
__checkUsernameDuplicate(event: FocusEvent): void { __checkUsernameDuplicate(event: FocusEvent): void {