추천인코드 조회 연동
This commit is contained in:
parent
c1fcd18554
commit
fa491c94a7
|
@ -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<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> {
|
||||
return new Promise<UpdateMemberReferrerResponse.Result>(
|
||||
(resolve, reject) => {
|
||||
|
|
|
@ -47,6 +47,15 @@
|
|||
>
|
||||
추천인 코드는 필수 입력입니다.
|
||||
</mat-error>
|
||||
<mat-error
|
||||
*ngIf="
|
||||
signupComposeForm
|
||||
?.get('referalCode')
|
||||
?.hasError('notExistReferalCode')
|
||||
"
|
||||
>
|
||||
추천인 코드는 필수 입력입니다.
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<!-- Divider -->
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user