회원수정 연동
This commit is contained in:
parent
97bc9e256d
commit
79f2c4250c
|
@ -478,7 +478,13 @@
|
|||
<span class="ml-2">An error occurred, try again!</span>
|
||||
</ng-container>
|
||||
</div>
|
||||
<button mat-flat-button [color]="'primary'">수정하기</button>
|
||||
<button
|
||||
mat-flat-button
|
||||
[color]="'primary'"
|
||||
(click)="__modifyMember()"
|
||||
>
|
||||
수정하기
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -34,6 +34,7 @@ import { UserService } from '../services/user.service';
|
|||
import { ActivatedRoute } from '@angular/router';
|
||||
import { GetMemberResponse } from 'app/modules/protobuf/c2se/backend/member_pb';
|
||||
import { MemberModel } from 'app/modules/protobuf/models/member/member_pb';
|
||||
import { MemberService } from 'app/modules/polyglot/member/services/member.service';
|
||||
|
||||
@Component({
|
||||
selector: 'user-view',
|
||||
|
@ -82,7 +83,8 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
private _changeDetectorRef: ChangeDetectorRef,
|
||||
private _fuseConfirmationService: FuseConfirmationService,
|
||||
private _formBuilder: FormBuilder,
|
||||
private _userService: UserService
|
||||
private _userService: UserService,
|
||||
private _memberService: MemberService
|
||||
) {}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
@ -204,4 +206,16 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
__trackByFn(index: number, item: any): any {
|
||||
return item.id || index;
|
||||
}
|
||||
|
||||
__modifyMember(): void {
|
||||
const valueForm = this.memberViewForm.value;
|
||||
console.log('v: ', valueForm);
|
||||
this._memberService.updateMember(
|
||||
this.selectedUser!.getId(),
|
||||
this.selectedUser!.getSite()!.getId(),
|
||||
this.selectedUser!.getMemberLevel()!.getId(),
|
||||
'beteran',
|
||||
valueForm.phoneNumber
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,9 @@ import {
|
|||
SUBJECT_LIST_MEMBERS,
|
||||
SUBJECT_GET_MEMBER,
|
||||
SUBJECT_GET_MEMBER_BY_USERNAME,
|
||||
UpdateMemberRequest,
|
||||
UpdateMemberResponse,
|
||||
SUBJECT_UPDATE_MEMBER,
|
||||
} from 'app/modules/protobuf/c2se/backend/member_pb';
|
||||
import { Pagination } from 'app/modules/protobuf/protobuf/pagination/pagination_pb';
|
||||
|
||||
|
@ -108,4 +111,92 @@ export class MemberService {
|
|||
}
|
||||
);
|
||||
}
|
||||
|
||||
updateMember(
|
||||
id: string,
|
||||
siteId: string,
|
||||
memberLevelId: string,
|
||||
password: string,
|
||||
mobilePhoneNumber: string
|
||||
): Promise<UpdateMemberResponse.Result> {
|
||||
return new Promise<UpdateMemberResponse.Result>((resolve, reject) => {
|
||||
let req = new UpdateMemberRequest();
|
||||
req.setId(id);
|
||||
|
||||
if (!!siteId) {
|
||||
req.setSiteId(siteId);
|
||||
}
|
||||
if (!!memberLevelId) {
|
||||
req.setMemberLevelId(memberLevelId);
|
||||
}
|
||||
if (!!password) {
|
||||
req.setPassword(password);
|
||||
}
|
||||
if (!!mobilePhoneNumber) {
|
||||
req.setMobilePhoneNumber(mobilePhoneNumber);
|
||||
}
|
||||
|
||||
this.__natsService
|
||||
.request<UpdateMemberResponse.Result>(
|
||||
SUBJECT_UPDATE_MEMBER,
|
||||
req.serializeBinary(),
|
||||
UpdateMemberResponse.deserializeBinary
|
||||
)
|
||||
.then((result) => {
|
||||
console.log('updateMember Result: ', result);
|
||||
resolve(result);
|
||||
})
|
||||
.catch((e: Error) => {
|
||||
console.log('failed', e);
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// siteId: 8429a7ab-b9de-400b-a209-28ff46e22bec
|
||||
// classId: 4b014ef5-3bab-4413-aaf9-b0040a70ec77
|
||||
// levelId: c56231ac-2120-4a81-a30a-5d41fafb6c57
|
||||
|
||||
// createMember(
|
||||
// siteId: string = '8429a7ab-b9de-400b-a209-28ff46e22bec',
|
||||
// memberLevelId: string = 'c56231ac-2120-4a81-a30a-5d41fafb6c57',
|
||||
// classId: string = '4b014ef5-3bab-4413-aaf9-b0040a70ec77',
|
||||
// signinId: string,
|
||||
// nickname: string,
|
||||
// password: string,
|
||||
// mobilePhoneNumber: string
|
||||
// ): Promise<MemberRequ.Result> {
|
||||
// return new Promise<UpdateMemberResponse.Result>((resolve, reject) => {
|
||||
// let req = new UpdateMemberRequest();
|
||||
// req.setId(id);
|
||||
|
||||
// if (!!siteId) {
|
||||
// req.setSiteId(siteId);
|
||||
// }
|
||||
// if (!!memberLevelId) {
|
||||
// req.setMemberLevelId(memberLevelId);
|
||||
// }
|
||||
// if (!!password) {
|
||||
// req.setPassword(password);
|
||||
// }
|
||||
// if (!!mobilePhoneNumber) {
|
||||
// req.setMobilePhoneNumber(mobilePhoneNumber);
|
||||
// }
|
||||
|
||||
// this.__natsService
|
||||
// .request<UpdateMemberResponse.Result>(
|
||||
// SUBJECT_UPDATE_MEMBER,
|
||||
// req.serializeBinary(),
|
||||
// UpdateMemberResponse.deserializeBinary
|
||||
// )
|
||||
// .then((result) => {
|
||||
// console.log('updateMember Result: ', result);
|
||||
// resolve(result);
|
||||
// })
|
||||
// .catch((e: Error) => {
|
||||
// console.log('failed', e);
|
||||
// reject(e);
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user