diff --git a/src/components/tableWrapper/TablePaginatedWrapper.jsx b/src/components/tableWrapper/TablePaginatedWrapper.jsx index 686fd90..d76c610 100644 --- a/src/components/tableWrapper/TablePaginatedWrapper.jsx +++ b/src/components/tableWrapper/TablePaginatedWrapper.jsx @@ -17,7 +17,7 @@ export default function TablePaginatedWrapper({ const handleNext = () => { setPage(prev => prev + 1) }; -console.log('isFetching', isFetching) + return (
diff --git a/src/components/transactions/TransactionsCom.jsx b/src/components/transactions/TransactionsCom.jsx index 32e1169..be94371 100644 --- a/src/components/transactions/TransactionsCom.jsx +++ b/src/components/transactions/TransactionsCom.jsx @@ -16,14 +16,22 @@ export default function TransactionsCom() { const [allTransactions, setAllTransaction] = useState({loading:true, error:'', data:{}}) const [willFilter, setWillFilter] = useState(false) - const [filter, setFilter] = useState({transaction_id: '', account_id: ''}) + const [filter, setFilter] = useState({type: '', id: ''}) const handleFilter = ({target:{name, value}}) => { setFilter(prev => ({...prev, [name]:value})) } const handleFilterByParams = () => { - setPage(1) - setWillFilter(prev => !prev) + if(filter.type && !filter.id){ + return + }else if(!filter.type){ + setPage(1) + setWillFilter(prev => !prev) + setFilter({type: '', id: ''}) + }else{ + setPage(1) + setWillFilter(prev => !prev) + } } const transactions = allTransactions?.data?.transactions // TRANSACTIONS LIST @@ -33,7 +41,8 @@ export default function TransactionsCom() { useEffect(()=>{ setAllTransaction(prev => ({...prev, loading:true})) - getTransactions({...filter, page}).then(res => { + const payload = filter?.type ? {[filter?.type]: filter.id} : {} + getTransactions({...payload, page}).then(res => { if(res?.status != 200){ setAllTransaction(prev => ({...prev, loading:false})) return @@ -58,28 +67,16 @@ export default function TransactionsCom() {
-

Transaction ID

- - <> - {transactions?.map((item, index) => ( - - ))} - + +
-

Account ID

- +
- +
{/* end of filter section */}