WA-238 Adding callback after changing threshold

This commit is contained in:
apanizo 2018-06-06 09:15:42 +02:00
parent d3af885074
commit ee0165ad28
2 changed files with 6 additions and 4 deletions

View File

@ -63,7 +63,7 @@ class GnoSafe extends React.PureComponent<SafeProps, State> {
onEditThreshold = () => { onEditThreshold = () => {
const { safe } = this.props const { safe } = this.props
this.setState({ component: <Threshold numOwners={safe.get('owners').count()} safe={safe} /> }) this.setState({ component: <Threshold numOwners={safe.get('owners').count()} safe={safe} onReset={this.onListTransactions} /> })
} }
render() { render() {

View File

@ -17,6 +17,7 @@ import selector, { type SelectorProps } from './selector'
type Props = SelectorProps & { type Props = SelectorProps & {
numOwners: number, numOwners: number,
safe: Safe, safe: Safe,
onReset: () => void,
} }
const THRESHOLD_PARAM = 'threshold' const THRESHOLD_PARAM = 'threshold'
@ -62,13 +63,13 @@ class Threshold extends React.PureComponent<Props, State> {
const gnosisSafe = await getSafeEthereumInstance(safe.get('address')) const gnosisSafe = await getSafeEthereumInstance(safe.get('address'))
const nonce = Date.now() const nonce = Date.now()
const data = gnosisSafe.contract.changeThreshold.getData(newThreshold) const data = gnosisSafe.contract.changeThreshold.getData(newThreshold)
await createTransaction(safe, "Change Safe's threshold", safe.get('address'), 0, nonce, userAddress, data) await createTransaction(safe, `Change Safe's threshold [${nonce}]`, safe.get('address'), 0, nonce, userAddress, data)
await sleep(1500) await sleep(1500)
// this.props.fetchThreshold(safe.get('address')) // this.props.fetchThreshold(safe.get('address'))
} }
render() { render() {
const { numOwners } = this.props const { numOwners, onReset } = this.props
return ( return (
<GnoForm <GnoForm
@ -82,8 +83,9 @@ class Threshold extends React.PureComponent<Props, State> {
<Button <Button
variant="raised" variant="raised"
color="primary" color="primary"
onClick={submitSucceeded ? onReset : undefined}
type="submit" type="submit"
disabled={submitting || submitSucceeded} disabled={submitting}
> >
{ submitSucceeded ? 'VISIT TXs' : 'FINISH' } { submitSucceeded ? 'VISIT TXs' : 'FINISH' }
</Button> </Button>