From aad7abe211c3311444b5b4f3208ac4a3af0f24ee Mon Sep 17 00:00:00 2001 From: crusader Date: Sun, 27 May 2018 16:05:54 +0900 Subject: [PATCH] ing --- projects/loafer/ng-rpc/src/lib/client/RPCClient.ts | 6 +++--- .../ng-rpc/src/lib/protocol/json/JSONRPCClientCodec.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/projects/loafer/ng-rpc/src/lib/client/RPCClient.ts b/projects/loafer/ng-rpc/src/lib/client/RPCClient.ts index b46db31..2b26737 100644 --- a/projects/loafer/ng-rpc/src/lib/client/RPCClient.ts +++ b/projects/loafer/ng-rpc/src/lib/client/RPCClient.ts @@ -130,15 +130,15 @@ export abstract class RPCClient { this._pendingRequests.delete(id); this._pendingRequestsCount--; - if (undefined !== result) { - reqState.subject.next(result); - } else if (undefined !== error) { + if (undefined !== error) { const rpcClientError: RPCClientError = { request: reqState.request, response: error, }; console.error(rpcClientError); reqState.subject.error(rpcClientError); + } else { + reqState.subject.next(result); } } diff --git a/projects/loafer/ng-rpc/src/lib/protocol/json/JSONRPCClientCodec.ts b/projects/loafer/ng-rpc/src/lib/protocol/json/JSONRPCClientCodec.ts index 27d3980..a18971d 100644 --- a/projects/loafer/ng-rpc/src/lib/protocol/json/JSONRPCClientCodec.ts +++ b/projects/loafer/ng-rpc/src/lib/protocol/json/JSONRPCClientCodec.ts @@ -94,10 +94,10 @@ export class JSONRPCClientResponseCodec implements RPCClientResponseCodec { } public isNotification(): boolean { - if (undefined !== this.id() || undefined === this.result()) { - return false; + if (undefined === this.id() && undefined !== this.result()) { + return true; } - return true; + return false; } public notification(): RPCClientNotificationCodec | undefined {