Skip to content

Commit

Permalink
fix: Clear generate tx when close password request dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
yanguoyu committed Sep 25, 2023
1 parent a783599 commit 47be893
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/neuron-ui/src/components/History/RowExtend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const RowExtend = ({ column, columns, isMainnet, id, bestBlockNumber }: RowExten
)

const { blockNumber, hash, description } = column
const confirmations = 1 + bestBlockNumber - +blockNumber
const confirmations = blockNumber ? 1 + bestBlockNumber - +blockNumber : 0
const confirmationsLabel = confirmations > 1000 ? '1,000+' : localNumberFormatter(confirmations)
const isSelected = localDescription.key === column.hash
const onCopy = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import { addNotification } from './app'

export const sendCreateSUDTAccountTransaction =
(params: Controller.SendCreateSUDTAccountTransaction.Params) => async (dispatch: StateDispatch) =>
sendTxBaseAction(sendCreateAccountTx, params, dispatch, addNotification)
sendTxBaseAction(sendCreateAccountTx, params, dispatch)

export const sendSUDTTransaction = (params: Controller.SendSUDTTransaction.Params) => async (dispatch: StateDispatch) =>
sendTxBaseAction(sendSUDTTx, params, dispatch, addNotification)
sendTxBaseAction(sendSUDTTx, params, dispatch)

export const migrateAcp = (params: Controller.MigrateAcp.Params) => async (dispatch: StateDispatch) => {
dispatch({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const setCurrentWallet = (id: string) => (dispatch: StateDispatch) => {
}

export const sendTransaction = (params: Controller.SendTransactionParams) => async (dispatch: StateDispatch) =>
sendTxBaseAction(sendTx, params, dispatch, addNotification)
sendTxBaseAction(sendTx, params, dispatch)

export const updateAddressListAndBalance =
(params: Controller.GetAddressesByWalletIDParams) => (dispatch: StateDispatch) => {
Expand Down
16 changes: 8 additions & 8 deletions packages/neuron-ui/src/utils/baseActions.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { AppActions } from 'states'
import { AppActions, showGlobalAlertDialog } from 'states'
import { isSuccessResponse } from './is'
import { ErrorCode, ResponseCode } from './enums'

export const sendTxBaseAction = async (sendMethod: any, params: any, dispatch: any, addNotification: any) => {
export const sendTxBaseAction = async (sendMethod: any, params: any, dispatch: any) => {
dispatch({ type: AppActions.UpdateLoadings, payload: { sending: true } })
try {
const res = await sendMethod(params)
if (isSuccessResponse(res)) {
dispatch({ type: AppActions.DismissPasswordRequest })
} else if (res.status !== ErrorCode.PasswordIncorrect && res.status !== ErrorCode.SignTransactionFailed) {
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,
showGlobalAlertDialog({
type: 'failed',
title: typeof res.message === 'string' ? res.message : res.message.content,
message: typeof res.message === 'string' ? undefined : res.message.meta,
action: 'ok',
})(dispatch)
dispatch({ type: AppActions.DismissPasswordRequest })
}
dispatch({ type: AppActions.UpdateGeneratedTx })
return res
} catch (err) {
console.warn(err)
Expand Down

0 comments on commit 47be893

Please sign in to comment.