diff --git a/src/api/api.js b/src/api/api.js index dca4887..ecbfe72 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -122,8 +122,10 @@ export const get_page_mining = () => { return getApi('v1/page_mining') } -export const get_page_account = () => { - return getApi('v1/page_account') +export const get_page_account = (address) => { + return getApiWith('v1/page_account', { + address, + }) } export const get_page_team = () => { @@ -131,20 +133,20 @@ export const get_page_team = () => { } export const get_withdrawal_history = (address) => { - return getApi('v1/withdrawal_history', { + return getApiWith('v1/withdrawal_history', { address, }) } export const get_daily_revenue_history = (address) => { - return getApi('v1/daily_revenue_history', { + return getApiWith('v1/daily_revenue_history', { address, }) } export const get_reward_history = (address) => { - return getApi('v1/reward_history', { + return getApiWith('v1/reward_history', { address, }) } diff --git a/src/pages/Account.js b/src/pages/Account.js index 4e58b8d..4d5e1fd 100644 --- a/src/pages/Account.js +++ b/src/pages/Account.js @@ -14,6 +14,23 @@ import { } from '../api' import { useApp } from '../AppContext' +const NoData = () => (
No Data
) +const THead = ({ children }) => ({children}) +const TRow = ({ children }) => ( + + {children} + +) + +const WithdrawStatus = (status) => { + if (status == 0) { + return Processing + } else if (status == 1) { + return Done + } else if (status == 2) { + return Rejected + } +} let accountData = [ { name: 'Total output', value: 0, emp: false, unit: 'USDT' }, @@ -21,14 +38,6 @@ let accountData = [ { name: 'Withdrawal balance', value: 0, emp: false, unit: 'USDT' }, ] -const NoData = () => ( - - - No Available Data - - -) - export const Account = () => { const app = useApp() @@ -50,30 +59,33 @@ export const Account = () => { } React.useEffect(() => { - if (app.address) { - get_page_account(app.address).then(res => { - console.log(res.data) - const d = res.data - let newAccount = [...accountData] - newAccount[0].value = d.output - newAccount[1].value = d.balance - newAccount[2].value = d.withdrawal - setAccountInfo(newAccount) + // if (app.address) { + get_page_account('0xb308ED17897105cAac3f9813DD35c2eBc64b9A65').then(res => { + console.log(res.data) + const d = res.data + let newAccount = [...accountData] + newAccount[0].value = d.output + newAccount[1].value = d.balance + newAccount[2].value = d.withdrawal + setAccountInfo(newAccount) - }).catch(err => { - console.error(err.message) - }) + }).catch(err => { + console.error(err.message) + }) - get_withdrawal_history().then(res => { - console.log(res.data) - }) - get_daily_revenue_history().then(res => { - console.log(res.data) - }) - get_reward_history().then(res => { - console.log(res.data) - }) - } + get_withdrawal_history('0xb308ED17897105cAac3f9813DD35c2eBc64b9A65').then(res => { + setWithdrawalHist(res.data) + console.log(res.data) + }) + get_daily_revenue_history('0xb308ED17897105cAac3f9813DD35c2eBc64b9A65').then(res => { + setDailyRevenueHist(res.data) + console.log(res.data) + }) + get_reward_history('0xb308ED17897105cAac3f9813DD35c2eBc64b9A65').then(res => { + setRewardHist(res.data) + console.log(res.data) + }) + // } }, [app.address]) return ( @@ -82,8 +94,8 @@ export const Account = () => { - Withdrawal - Record + Withdrawal + Record @@ -98,7 +110,7 @@ export const Account = () => { - Withdraw + Amount: { - + {/* header */} + Time Quantity Status - + { - withdrawalHist ? - <> - + withdrawalHist.length ? + withdrawalHist.map(h => ( + + {h.created_at.substring(0, 10)} + {h.true_balance || 0} + { + WithdrawStatus(h.status) + } + + )) : - 'No Data.' + } - + Time Quantity Type - + { - dailyRevenueHist ? - <> - + dailyRevenueHist.length ? + dailyRevenueHist.map(h => ( + + {h.created_at.substring(0, 10)} + {h.money || 0} + Claimed + + + )) : - 'No Data.' + } - + Time Quantity User Address - + { - rewardHist ? + rewardHist.length ? <> : - 'No Data.' + }