diff --git a/packages/neuron-ui/src/services/remote/controllerMethodWrapper.ts b/packages/neuron-ui/src/services/remote/controllerMethodWrapper.ts index be8efaa72a..6bef71266c 100644 --- a/packages/neuron-ui/src/services/remote/controllerMethodWrapper.ts +++ b/packages/neuron-ui/src/services/remote/controllerMethodWrapper.ts @@ -56,9 +56,17 @@ export const controllerMethodWrapper = (controllerName: string) => ( result: res.result || null, } } + + let title = '' + + if (typeof res === 'string') { + title = res + } else if (typeof res.msg === 'string') { + title = res.msg + } return { status: 0, - message: { title: (res && res.msg) || '' }, + message: { title }, } } diff --git a/packages/neuron-ui/src/states/stateProvider/actionCreators/wallets.ts b/packages/neuron-ui/src/states/stateProvider/actionCreators/wallets.ts index 84f2af8089..632ef80f7e 100644 --- a/packages/neuron-ui/src/states/stateProvider/actionCreators/wallets.ts +++ b/packages/neuron-ui/src/states/stateProvider/actionCreators/wallets.ts @@ -113,7 +113,8 @@ export const sendTransaction = (params: Controller.SendTransaction) => (dispatch if (res.status) { history.push(Routes.History) } else { - addNotification({ type: 'alert', content: JSON.stringify(res.message.title) })(dispatch) + // TODO: the pretreatment is unnecessary once the error code is implemented + addNotification({ type: 'alert', content: res.message.title.replace(/(\b"|"\b)/g, '') })(dispatch) } dispatch({ type: AppActions.DismissPasswordRequest,