From 226af990b0f611364270f365e3299bf802bdc041 Mon Sep 17 00:00:00 2001 From: leejh Date: Mon, 23 Sep 2019 15:17:48 +0900 Subject: [PATCH] =?UTF-8?q?take=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/services/buddy-protocol.service.ts | 17 ++++++++++---- .../lib/services/group-protocol.service.ts | 22 ++++++++++++++----- .../src/lib/services/room-protocol.service.ts | 22 ++++++++++++++----- 3 files changed, 47 insertions(+), 14 deletions(-) diff --git a/projects/ucap-webmessenger-protocol-buddy/src/lib/services/buddy-protocol.service.ts b/projects/ucap-webmessenger-protocol-buddy/src/lib/services/buddy-protocol.service.ts index 01f79dcd..365fd17c 100644 --- a/projects/ucap-webmessenger-protocol-buddy/src/lib/services/buddy-protocol.service.ts +++ b/projects/ucap-webmessenger-protocol-buddy/src/lib/services/buddy-protocol.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { map, take } from 'rxjs/operators'; import { ProtocolService } from '@ucap-webmessenger/protocol'; @@ -40,18 +40,27 @@ export class BuddyProtocolService { public buddyAdd(req: BuddyAddRequest): Observable { return this.protocolService .call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_ADD_REQ, ...encodeBuddyAdd(req)) - .pipe(map(res => decodeBuddyAdd(res))); + .pipe( + take(1), + map(res => decodeBuddyAdd(res)) + ); } public buddyDel(req: BuddyDelRequest): Observable { return this.protocolService .call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_DEL_REQ, ...encodeBuddyDel(req)) - .pipe(map(res => decodeBuddyDel(res))); + .pipe( + take(1), + map(res => decodeBuddyDel(res)) + ); } public buddyUpdate(req: BuddyUpdateRequest): Observable { return this.protocolService .call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_UPD_REQ, ...encodeBuddyUpdate(req)) - .pipe(map(res => decodeBuddyUpdate(res))); + .pipe( + take(1), + map(res => decodeBuddyUpdate(res)) + ); } } diff --git a/projects/ucap-webmessenger-protocol-group/src/lib/services/group-protocol.service.ts b/projects/ucap-webmessenger-protocol-group/src/lib/services/group-protocol.service.ts index a89df3d1..9649ad8a 100644 --- a/projects/ucap-webmessenger-protocol-group/src/lib/services/group-protocol.service.ts +++ b/projects/ucap-webmessenger-protocol-group/src/lib/services/group-protocol.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { map, take } from 'rxjs/operators'; import { ProtocolService } from '@ucap-webmessenger/protocol'; import { @@ -40,19 +40,28 @@ export class GroupProtocolService { public groupAdd(req: GroupAddRequest): Observable { return this.protocolService .call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_ADD_REQ, ...encodeGroupAdd(req)) - .pipe(map(res => decodeGroupAdd(res))); + .pipe( + take(1), + map(res => decodeGroupAdd(res)) + ); } public groupDel(req: GroupDelRequest): Observable { return this.protocolService .call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_DEL_REQ, ...encodeGroupDel(req)) - .pipe(map(res => decodeGroupDel(res))); + .pipe( + take(1), + map(res => decodeGroupDel(res)) + ); } public groupUpdate(req: GroupUpdateRequest): Observable { return this.protocolService .call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_UPD_REQ, ...encodeGroupUpdate(req)) - .pipe(map(res => decodeGroupUpdate(res))); + .pipe( + take(1), + map(res => decodeGroupUpdate(res)) + ); } public groupUpdate2( @@ -64,6 +73,9 @@ export class GroupProtocolService { SSVC_TYPE_GROUP_UPD_REQ2, ...encodeGroupUpdate2(req) ) - .pipe(map(res => decodeGroupUpdate2(res))); + .pipe( + take(1), + map(res => decodeGroupUpdate2(res)) + ); } } diff --git a/projects/ucap-webmessenger-protocol-room/src/lib/services/room-protocol.service.ts b/projects/ucap-webmessenger-protocol-room/src/lib/services/room-protocol.service.ts index ac75281c..af9438c3 100644 --- a/projects/ucap-webmessenger-protocol-room/src/lib/services/room-protocol.service.ts +++ b/projects/ucap-webmessenger-protocol-room/src/lib/services/room-protocol.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { map, take } from 'rxjs/operators'; import { ProtocolService } from '@ucap-webmessenger/protocol'; import { @@ -45,24 +45,36 @@ export class RoomProtocolService { public roomOpen(req: RoomOpenRequest): Observable { return this.protocolService .call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN_REQ, ...encodeRoomOpen(req)) - .pipe(map(res => decodeRoomOpen(res))); + .pipe( + take(1), + map(res => decodeRoomOpen(res)) + ); } public roomOpen2(req: RoomOpen2Request): Observable { return this.protocolService .call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN2_REQ, ...encodeRoomOpen2(req)) - .pipe(map(res => decodeRoomOpen2(res))); + .pipe( + take(1), + map(res => decodeRoomOpen2(res)) + ); } public roomOpen3(req: RoomOpen3Request): Observable { return this.protocolService .call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN3_REQ, ...encodeRoomOpen3(req)) - .pipe(map(res => decodeRoomOpen3(res))); + .pipe( + take(1), + map(res => decodeRoomOpen3(res)) + ); } public roomOpen4(req: RoomOpen4Request): Observable { return this.protocolService .call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN4_REQ, ...encodeRoomOpen4(req)) - .pipe(map(res => decodeRoomOpen4(res))); + .pipe( + take(1), + map(res => decodeRoomOpen4(res)) + ); } }