bug fix
This commit is contained in:
parent
58b1823b83
commit
f56243ca10
|
@ -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;
|
|
|
@ -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 {
|
return {
|
||||||
type: `${requestType}/FAILURE`,
|
type: `${requestType}/FAILURE`,
|
||||||
payload: error,
|
error: error,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,11 +31,6 @@ enum WebSocketReadyState {
|
||||||
CLOSED = 3,
|
CLOSED = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RuntimeError {
|
|
||||||
type: string;
|
|
||||||
data?: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class WebSocketRPC {
|
export default class WebSocketRPC {
|
||||||
private url: string;
|
private url: string;
|
||||||
private connStatus: WebSocketStatus;
|
private connStatus: WebSocketStatus;
|
||||||
|
@ -152,10 +147,11 @@ export default class WebSocketRPC {
|
||||||
promise.resolve(result);
|
promise.resolve(result);
|
||||||
} else if (null != error) {
|
} else if (null != error) {
|
||||||
if (ErrorCode.E_RUNTIME === error.Code) {
|
if (ErrorCode.E_RUNTIME === error.Code) {
|
||||||
const runTimeError: RuntimeError = {
|
const returnError: Error = {
|
||||||
type: error.Message,
|
name: error.Message,
|
||||||
|
message: null,
|
||||||
};
|
};
|
||||||
promise.reject(runTimeError);
|
promise.reject(returnError);
|
||||||
} else {
|
} else {
|
||||||
console.log(`System error[${error.Code}|${error.Message}|${error.Data}]`);
|
console.log(`System error[${error.Code}|${error.Message}|${error.Data}]`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ export function mapDispatchToProps(dispatch: Dispatch<any>, ownProps?: any): Sig
|
||||||
return {
|
return {
|
||||||
onSignIn: (signinId: string, signinPw: string) => {
|
onSignIn: (signinId: string, signinPw: string) => {
|
||||||
// dispatch(signinActions.request(signinId, signinPw));
|
// dispatch(signinActions.request(signinId, signinPw));
|
||||||
dispatch(asyncRequestActions.request('MemberService1', 'signin', signinActions.REQUEST, signinId, signinPw));
|
dispatch(asyncRequestActions.request('MemberService', 'signin', signinActions.REQUEST, signinId, signinPw));
|
||||||
},
|
},
|
||||||
onRedirectHome: () => {
|
onRedirectHome: () => {
|
||||||
dispatch(routerPush('/'));
|
dispatch(routerPush('/'));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user