aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/higher-order-components/with-method-data
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@gmail.com>2018-07-31 13:03:20 +0800
committerAlexander Tseung <alextsg@gmail.com>2018-08-24 07:44:44 +0800
commit5ee40675b9f986a9ff2e5d15a271d7de2145d0e9 (patch)
tree80f4b3e0a88a5621724a05efeb320596e0bcedad /ui/app/higher-order-components/with-method-data
parentd733bd34fbd356bca640b3a50582208c0284be40 (diff)
downloadtangerine-wallet-browser-5ee40675b9f986a9ff2e5d15a271d7de2145d0e9.tar.gz
tangerine-wallet-browser-5ee40675b9f986a9ff2e5d15a271d7de2145d0e9.tar.zst
tangerine-wallet-browser-5ee40675b9f986a9ff2e5d15a271d7de2145d0e9.zip
Refactor transactions list views. Add redesign components
Diffstat (limited to 'ui/app/higher-order-components/with-method-data')
-rw-r--r--ui/app/higher-order-components/with-method-data/with-method-data.component.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/ui/app/higher-order-components/with-method-data/with-method-data.component.js b/ui/app/higher-order-components/with-method-data/with-method-data.component.js
index aa38afd8a..c05d33c20 100644
--- a/ui/app/higher-order-components/with-method-data/with-method-data.component.js
+++ b/ui/app/higher-order-components/with-method-data/with-method-data.component.js
@@ -1,6 +1,6 @@
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
-import { getMethodData } from '../../helpers/confirm-transaction/util'
+import { getMethodData } from '../../helpers/transactions.util'
export default function withMethodData (WrappedComponent) {
return class MethodDataWrappedComponent extends PureComponent {
@@ -13,7 +13,11 @@ export default function withMethodData (WrappedComponent) {
}
state = {
- methodData: {},
+ methodData: {
+ data: {},
+ },
+ isFetching: false,
+ error: null,
}
componentDidMount () {
@@ -25,18 +29,24 @@ export default function withMethodData (WrappedComponent) {
const { txParams: { data = '' } = {} } = transaction
if (data) {
- const methodData = await getMethodData(data)
- this.setState({ methodData })
+ this.setState({ isFetching: true })
+
+ try {
+ const methodData = await getMethodData(data)
+ this.setState({ methodData, isFetching: false })
+ } catch (error) {
+ this.setState({ isFetching: false, error })
+ }
}
}
render () {
- const { methodData } = this.state
+ const { methodData, isFetching, error } = this.state
return (
<WrappedComponent
{ ...this.props }
- methodData={methodData}
+ methodData={{ data: methodData, isFetching, error }}
/>
)
}