Merge pull request #19 from gnosis/feature/WA-230-automatic-update-balance
WA-230 Introducing interval for checking balance
This commit is contained in:
commit
1c7aff9f26
|
@ -6,15 +6,25 @@ import Layout from '~/routes/safe/component/Layout'
|
||||||
import selector, { type SelectorProps } from './selector'
|
import selector, { type SelectorProps } from './selector'
|
||||||
import actions, { type Actions } from './actions'
|
import actions, { type Actions } from './actions'
|
||||||
|
|
||||||
class SafeView extends React.PureComponent<Actions & SelectorProps> {
|
type Props = Actions & SelectorProps
|
||||||
|
|
||||||
|
class SafeView extends React.PureComponent<Props> {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this.intervalId = setInterval(() => {
|
||||||
const { safe, fetchBalance } = this.props
|
const { safe, fetchBalance } = this.props
|
||||||
if (!safe) { return }
|
if (!safe) { return }
|
||||||
|
|
||||||
const safeAddress: string = safe.get('address')
|
const safeAddress: string = safe.get('address')
|
||||||
fetchBalance(safeAddress)
|
fetchBalance(safeAddress)
|
||||||
|
}, 1500)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
clearInterval(this.intervalId)
|
||||||
|
}
|
||||||
|
|
||||||
|
intervalId: IntervalID
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { safe, provider, balance } = this.props
|
const { safe, provider, balance } = this.props
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue