From f56243ca10474f50c9b547fcbf57539b079b9bb0 Mon Sep 17 00:00:00 2001 From: crusader Date: Mon, 14 Aug 2017 19:36:43 +0900 Subject: [PATCH] bug fix --- src/ts/@overflow/commons/api/Service.ts | 22 ------------------- .../commons/redux/action/asyncRequest.ts | 4 ++-- .../commons/websocket/WebSocketRPC.ts | 12 ++++------ src/ts/@overflow/member/react/SignIn.tsx | 2 +- 4 files changed, 7 insertions(+), 33 deletions(-) delete mode 100644 src/ts/@overflow/commons/api/Service.ts diff --git a/src/ts/@overflow/commons/api/Service.ts b/src/ts/@overflow/commons/api/Service.ts deleted file mode 100644 index a751566..0000000 --- a/src/ts/@overflow/commons/api/Service.ts +++ /dev/null @@ -1,22 +0,0 @@ -import WebSocketRPC from '../websocket/WebSocketRPC'; - -abstract class Service { - private webSocketRPC: WebSocketRPC; - private name: string; - protected constructor(name: string) { - this.name = name; - - } - - protected send(methodName: string, args: any): Promise { - return this.webSocketRPC.Call(`${this.name}.${methodName}`, args) - .then(result => { - return result; - }) - .catch(e => { - throw e; - }); - } -} - -export default Service; diff --git a/src/ts/@overflow/commons/redux/action/asyncRequest.ts b/src/ts/@overflow/commons/redux/action/asyncRequest.ts index c37b648..303f5e9 100644 --- a/src/ts/@overflow/commons/redux/action/asyncRequest.ts +++ b/src/ts/@overflow/commons/redux/action/asyncRequest.ts @@ -30,9 +30,9 @@ export const requestSuccess: requestSuccess = (requestType: string, result: any) }; }; -export const requestFailure: requestFailure = (requestType: string, error: any): Action => { +export const requestFailure: requestFailure = (requestType: string, error: Error): Action => { return { type: `${requestType}/FAILURE`, - payload: error, + error: error, }; }; diff --git a/src/ts/@overflow/commons/websocket/WebSocketRPC.ts b/src/ts/@overflow/commons/websocket/WebSocketRPC.ts index b0ce108..110162a 100644 --- a/src/ts/@overflow/commons/websocket/WebSocketRPC.ts +++ b/src/ts/@overflow/commons/websocket/WebSocketRPC.ts @@ -31,11 +31,6 @@ enum WebSocketReadyState { CLOSED = 3, } -export interface RuntimeError { - type: string; - data?: any; -} - export default class WebSocketRPC { private url: string; private connStatus: WebSocketStatus; @@ -152,10 +147,11 @@ export default class WebSocketRPC { promise.resolve(result); } else if (null != error) { if (ErrorCode.E_RUNTIME === error.Code) { - const runTimeError: RuntimeError = { - type: error.Message, + const returnError: Error = { + name: error.Message, + message: null, }; - promise.reject(runTimeError); + promise.reject(returnError); } else { console.log(`System error[${error.Code}|${error.Message}|${error.Data}]`); } diff --git a/src/ts/@overflow/member/react/SignIn.tsx b/src/ts/@overflow/member/react/SignIn.tsx index 92f64c8..390cf00 100644 --- a/src/ts/@overflow/member/react/SignIn.tsx +++ b/src/ts/@overflow/member/react/SignIn.tsx @@ -20,7 +20,7 @@ export function mapDispatchToProps(dispatch: Dispatch, ownProps?: any): Sig return { onSignIn: (signinId: string, signinPw: string) => { // dispatch(signinActions.request(signinId, signinPw)); - dispatch(asyncRequestActions.request('MemberService1', 'signin', signinActions.REQUEST, signinId, signinPw)); + dispatch(asyncRequestActions.request('MemberService', 'signin', signinActions.REQUEST, signinId, signinPw)); }, onRedirectHome: () => { dispatch(routerPush('/'));