WA-238 Updating UI after processing TX for changing threshold

This commit is contained in:
apanizo 2018-06-06 10:43:56 +02:00
parent 13c1152c5b
commit 31e5833b8e
4 changed files with 33 additions and 5 deletions

View File

@ -0,0 +1,16 @@
// @flow
import fetchThreshold from '~/routes/safe/store/actions/fetchThreshold'
import fetchTransactions from '~/routes/safe/store/actions/fetchTransactions'
type FetchThreshold = typeof fetchThreshold
type FetchTransactions = typeof fetchTransactions
export type Actions = {
fetchThreshold: FetchThreshold,
fetchTransactions: FetchTransactions,
}
export default {
fetchThreshold,
fetchTransactions,
}

View File

@ -13,8 +13,9 @@ import { composeValidators, minValue, maxValue, mustBeInteger, required } from '
import { getSafeEthereumInstance, createTransaction } from '~/routes/safe/component/AddTransaction/createTransactions'
import { sleep } from '~/utils/timer'
import selector, { type SelectorProps } from './selector'
import actions, { type Actions } from './actions'
type Props = SelectorProps & {
type Props = SelectorProps & Actions & {
numOwners: number,
safe: Safe,
onReset: () => void,
@ -65,7 +66,8 @@ class Threshold extends React.PureComponent<Props, State> {
const data = gnosisSafe.contract.changeThreshold.getData(newThreshold)
await createTransaction(safe, `Change Safe's threshold [${nonce}]`, safe.get('address'), 0, nonce, userAddress, data)
await sleep(1500)
// this.props.fetchThreshold(safe.get('address'))
this.props.fetchTransactions()
this.props.fetchThreshold(safe.get('address'))
}
render() {
@ -98,4 +100,4 @@ class Threshold extends React.PureComponent<Props, State> {
}
}
export default connect(selector)(Threshold)
export default connect(selector, actions)(Threshold)

View File

@ -1,10 +1,16 @@
// @flow
import fetchThreshold from '~/routes/safe/store/actions/fetchThreshold'
import fetchTransactions from '~/routes/safe/store/actions/fetchTransactions'
type FetchThreshold = typeof fetchThreshold
type FetchTransactions = typeof fetchTransactions
export type Actions = {
fetchTransactions: typeof fetchTransactions,
fetchThreshold: FetchThreshold,
fetchTransactions: FetchTransactions,
}
export default {
fetchThreshold,
fetchTransactions,
}

View File

@ -17,10 +17,14 @@ type Props = SelectorProps & Actions & {
}
class Transactions extends React.Component<Props, {}> {
onProcessTx = async (tx: Transaction, alreadyConfirmed: number) => {
const { fetchTransactions, safeAddress, userAddress } = this.props
const {
fetchTransactions, safeAddress, userAddress, fetchThreshold,
} = this.props
await processTransaction(safeAddress, tx, alreadyConfirmed, userAddress)
await sleep(1200)
fetchTransactions()
fetchThreshold(safeAddress)
}
render() {