mirror of
https://github.com/status-im/safe-react.git
synced 2025-01-11 02:25:40 +00:00
WA-238 Delaying fetchDailyLimit after withdrawing
This commit is contained in:
parent
a4a519ad8e
commit
d66ef07f98
@ -1,16 +1,22 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
|
import { CircularProgress } from 'material-ui/Progress'
|
||||||
import Block from '~/components/layout/Block'
|
import Block from '~/components/layout/Block'
|
||||||
import Bold from '~/components/layout/Bold'
|
import Bold from '~/components/layout/Bold'
|
||||||
import Heading from '~/components/layout/Heading'
|
import Heading from '~/components/layout/Heading'
|
||||||
import Paragraph from '~/components/layout/Paragraph'
|
import Paragraph from '~/components/layout/Paragraph'
|
||||||
import { DESTINATION_PARAM, VALUE_PARAM } from './withdrawn'
|
import { DESTINATION_PARAM, VALUE_PARAM } from '~/routes/safe/component/Withdrawn/withdrawn'
|
||||||
|
|
||||||
type FormProps = {
|
type FormProps = {
|
||||||
values: Object,
|
values: Object,
|
||||||
|
submitting: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
const Review = () => ({ values }: FormProps) => (
|
const spinnerStyle = {
|
||||||
|
minHeight: '50px',
|
||||||
|
}
|
||||||
|
|
||||||
|
const Review = () => ({ values, submitting }: FormProps) => (
|
||||||
<Block>
|
<Block>
|
||||||
<Heading tag="h2">Review the Withdrawn Operation</Heading>
|
<Heading tag="h2">Review the Withdrawn Operation</Heading>
|
||||||
<Paragraph align="left">
|
<Paragraph align="left">
|
||||||
@ -19,6 +25,9 @@ const Review = () => ({ values }: FormProps) => (
|
|||||||
<Paragraph align="left">
|
<Paragraph align="left">
|
||||||
<Bold>Value in ETH: </Bold> {values[VALUE_PARAM]}
|
<Bold>Value in ETH: </Bold> {values[VALUE_PARAM]}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
|
<Block style={spinnerStyle}>
|
||||||
|
{ submitting && <CircularProgress size={50} /> }
|
||||||
|
</Block>
|
||||||
</Block>
|
</Block>
|
||||||
)
|
)
|
||||||
|
|
@ -5,7 +5,7 @@ import TextField from '~/components/forms/TextField'
|
|||||||
import { composeValidators, mustBeNumber, required, greaterThan, mustBeEthereumAddress } from '~/components/forms/validator'
|
import { composeValidators, mustBeNumber, required, greaterThan, mustBeEthereumAddress } from '~/components/forms/validator'
|
||||||
import Block from '~/components/layout/Block'
|
import Block from '~/components/layout/Block'
|
||||||
import Heading from '~/components/layout/Heading'
|
import Heading from '~/components/layout/Heading'
|
||||||
import { DESTINATION_PARAM, VALUE_PARAM } from './withdrawn'
|
import { DESTINATION_PARAM, VALUE_PARAM } from '~/routes/safe/component/Withdrawn/withdrawn'
|
||||||
|
|
||||||
export const CONFIRMATIONS_ERROR = 'Number of confirmations can not be higher than the number of owners'
|
export const CONFIRMATIONS_ERROR = 'Number of confirmations can not be higher than the number of owners'
|
||||||
|
|
10
src/routes/safe/component/Withdrawn/actions.js
Normal file
10
src/routes/safe/component/Withdrawn/actions.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// @flow
|
||||||
|
import fetchDailyLimit from '~/routes/safe/store/actions/fetchDailyLimit'
|
||||||
|
|
||||||
|
export type Actions = {
|
||||||
|
fetchDailyLimit: typeof fetchDailyLimit,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
fetchDailyLimit,
|
||||||
|
}
|
@ -3,6 +3,8 @@ import * as React from 'react'
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import Stepper from '~/components/Stepper'
|
import Stepper from '~/components/Stepper'
|
||||||
import { SAFELIST_ADDRESS } from '~/routes/routes'
|
import { SAFELIST_ADDRESS } from '~/routes/routes'
|
||||||
|
import { sleep } from '~/utils/timer'
|
||||||
|
import actions, { type Actions } from './actions'
|
||||||
import selector, { type SelectorProps } from './selector'
|
import selector, { type SelectorProps } from './selector'
|
||||||
import withdrawn from './withdrawn'
|
import withdrawn from './withdrawn'
|
||||||
import WithdrawnForm from './WithdrawnForm'
|
import WithdrawnForm from './WithdrawnForm'
|
||||||
@ -12,7 +14,7 @@ const getSteps = () => [
|
|||||||
'Fill Withdrawn Form', 'Review Withdrawn',
|
'Fill Withdrawn Form', 'Review Withdrawn',
|
||||||
]
|
]
|
||||||
|
|
||||||
type Props = SelectorProps & {
|
type Props = SelectorProps & Actions & {
|
||||||
safeAddress: string,
|
safeAddress: string,
|
||||||
dailyLimit: DailyLimit,
|
dailyLimit: DailyLimit,
|
||||||
}
|
}
|
||||||
@ -32,6 +34,8 @@ class Withdrawn extends React.Component<Props, State> {
|
|||||||
try {
|
try {
|
||||||
const { safeAddress, userAddress } = this.props
|
const { safeAddress, userAddress } = this.props
|
||||||
await withdrawn(values, safeAddress, userAddress)
|
await withdrawn(values, safeAddress, userAddress)
|
||||||
|
await sleep(5000)
|
||||||
|
this.props.fetchDailyLimit(safeAddress)
|
||||||
this.setState({ done: true })
|
this.setState({ done: true })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.setState({ done: false })
|
this.setState({ done: false })
|
||||||
@ -66,5 +70,5 @@ class Withdrawn extends React.Component<Props, State> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(selector)(Withdrawn)
|
export default connect(selector, actions)(Withdrawn)
|
||||||
|
|
||||||
|
@ -24,6 +24,3 @@ describe('Safe Blockchain Test', () => {
|
|||||||
expect(executeWithdrawnOn(safeAddress, value)).rejects.toThrow('VM Exception while processing transaction: revert')
|
expect(executeWithdrawnOn(safeAddress, value)).rejects.toThrow('VM Exception while processing transaction: revert')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
// }
|
|
||||||
|
|
||||||
// export default updateDailyLimitReducerTests
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import fetchBalance from '~/routes/safe/store/actions/fetchBalance'
|
import fetchBalance from '~/routes/safe/store/actions/fetchBalance'
|
||||||
|
import fetchDailyLimit from '~/routes/safe/store/actions/fetchDailyLimit'
|
||||||
|
|
||||||
export type Actions = {
|
export type Actions = {
|
||||||
fetchBalance: typeof fetchBalance,
|
fetchBalance: typeof fetchBalance,
|
||||||
|
fetchDailyLimit: typeof fetchDailyLimit,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
fetchBalance,
|
fetchBalance,
|
||||||
|
fetchDailyLimit,
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ class SafeView extends React.PureComponent<Props> {
|
|||||||
const safeAddress: string = safe.get('address')
|
const safeAddress: string = safe.get('address')
|
||||||
fetchBalance(safeAddress)
|
fetchBalance(safeAddress)
|
||||||
}, 1500)
|
}, 1500)
|
||||||
|
|
||||||
|
this.props.fetchDailyLimit(this.props.safe.get('address'))
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user