fetch trade history on history table mount
This commit is contained in:
parent
132802fe12
commit
c59e61df82
|
@ -2,7 +2,6 @@ import useTradeHistory from '../hooks/useTradeHistory'
|
|||
|
||||
const TradeHistoryTable = () => {
|
||||
const { tradeHistory } = useTradeHistory()
|
||||
console.log('trade history', tradeHistory)
|
||||
|
||||
return (
|
||||
<div className={`flex flex-col py-6`}>
|
||||
|
|
|
@ -84,6 +84,12 @@ export const useTradeHistory = () => {
|
|||
setAllTrades(formatTradeHistory(results))
|
||||
}, [marginAccount])
|
||||
|
||||
useEffect(() => {
|
||||
if (marginAccount) {
|
||||
fetchTradeHistory()
|
||||
}
|
||||
}, [])
|
||||
|
||||
useInterval(() => {
|
||||
if (marginAccount && tradeHistory.length === 0) {
|
||||
fetchTradeHistory()
|
||||
|
|
Loading…
Reference in New Issue