diff --git a/packages/neuron-ui/src/components/OfflineSign/index.tsx b/packages/neuron-ui/src/components/OfflineSign/index.tsx index ebe5b8159b..8916a2077b 100644 --- a/packages/neuron-ui/src/components/OfflineSign/index.tsx +++ b/packages/neuron-ui/src/components/OfflineSign/index.tsx @@ -3,7 +3,8 @@ import { useTranslation } from 'react-i18next' import { useNavigate } from 'react-router-dom' import { isSuccessResponse, RoutePath, useDidMount } from 'utils' import Dialog from 'widgets/Dialog' -import { addNotification, useDispatch, useState as useGlobalState } from 'states' +import AlertDialog from 'widgets/AlertDialog' +import { useDispatch, useState as useGlobalState } from 'states' import { broadcastTransaction, getCurrentWallet, OfflineSignStatus } from 'services/remote' import { ReactComponent as HardWalletIcon } from 'widgets/Icons/HardWallet.svg' import OfflineSignDialog from '../OfflineSignDialog' @@ -20,6 +21,7 @@ const OfflineSign = () => { const [isBroadCasting, setIsBroadcasting] = useState(false) const [t] = useTranslation() const dispatch = useDispatch() + const [errMsg, setErrMsg] = useState('') const { filePath, json } = loadedTransaction @@ -60,19 +62,12 @@ const OfflineSign = () => { if (isSuccessResponse(res)) { navigate(RoutePath.History) } else { - addNotification({ - type: 'alert', - timestamp: +new Date(), - code: res.status, - content: typeof res.message === 'string' ? res.message : res.message.content, - meta: typeof res.message === 'string' ? undefined : res.message.meta, - })(dispatch) - onBack() + setErrMsg(typeof res.message === 'string' ? res.message : res.message.content || '') } } finally { setIsBroadcasting(false) } - }, [wallet, json, navigate, dispatch, onBack]) + }, [wallet, json, navigate, dispatch]) useDidMount(() => { getCurrentWallet().then(res => { @@ -93,43 +88,52 @@ const OfflineSign = () => { } return ( - -
- - - - - - - - - - - - - - - - - - -
{t('offline-sign.json-file')}{filePath}
{t('offline-sign.status.label')}{status}
{t('offline-sign.wallet')} - {wallet?.device ? : null} - {wallet?.name ?? ''} -
{t('offline-sign.content')}
-