This commit is contained in:
crusader 2017-08-14 19:36:43 +09:00
parent 58b1823b83
commit f56243ca10
4 changed files with 7 additions and 33 deletions

View File

@ -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<T>(methodName: string, args: any): Promise<T> {
return this.webSocketRPC.Call(`${this.name}.${methodName}`, args)
.then(result => {
return result;
})
.catch(e => {
throw e;
});
}
}
export default Service;

View File

@ -30,9 +30,9 @@ export const requestSuccess: requestSuccess = (requestType: string, result: any)
};
};
export const requestFailure: requestFailure = (requestType: string, error: any): Action<any> => {
export const requestFailure: requestFailure = (requestType: string, error: Error): Action<any> => {
return {
type: `${requestType}/FAILURE`,
payload: error,
error: error,
};
};

View File

@ -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}]`);
}

View File

@ -20,7 +20,7 @@ export function mapDispatchToProps(dispatch: Dispatch<any>, 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('/'));