Compare commits

...

1 Commits

Author SHA1 Message Date
victorAnumudu 497407112c unused code cleaned 2023-06-12 14:10:26 +01:00
+1 -45
View File
@@ -20,9 +20,6 @@ function Wallet() {
} }
const WalletRoutes = () => { const WalletRoutes = () => {
const apiCall = new usersService() const apiCall = new usersService()
@@ -38,18 +35,6 @@ const WalletRoutes = () => {
error: false error: false
}) })
let [purchaseHistory, setPurchaseHistory] = useState({ // FOR PURCHASE HISTORY
loading: true,
data: [],
error: false
})
let [couponHistory, setCouponHistory] = useState({ // FOR COUPON HISTORY
loading: true,
data: [],
error: false
})
//FUNCTION TO GET WALLET LIST //FUNCTION TO GET WALLET LIST
const getWalletList = ()=>{ const getWalletList = ()=>{
apiCall.getUserWallets(null).then((res)=>{ apiCall.getUserWallets(null).then((res)=>{
@@ -76,38 +61,9 @@ const WalletRoutes = () => {
}) })
} }
//FUNCTION TO GET PURCHASE HISTORY
const getPurchaseHistory = ()=>{
apiCall.getPurchaseHx().then((res)=>{
if(res.data.internal_return < 0){ // success but no data
setPurchaseHistory(prev => ({...prev, loading: false}))
return
}
// console.log('purchase',res.data)
setPurchaseHistory(prev => ({...prev, loading: false, data: res.data.result_list}))
}).catch((error)=>{
setPurchaseHistory(prev => ({...prev, loading: false, error: true}))
})
}
//FUNCTION TO GET COUPON HISTORY
const getCouponHistory = ()=>{
apiCall.getCouponHx().then((res)=>{
if(res.data.internal_return < 0){ // success but no data
setCouponHistory(prev => ({...prev, loading: false}))
return
}
setCouponHistory(prev => ({...prev, loading: false, data: res.data.result_list}))
}).catch((error)=>{
setCouponHistory(prev => ({...prev, loading: false, error: true}))
})
}
useEffect(()=>{ useEffect(()=>{
getWalletList() getWalletList()
getPaymentHistory() getPaymentHistory()
getPurchaseHistory()
getCouponHistory()
}, []) }, [])
return ( return (
<Routes> <Routes>
@@ -115,7 +71,7 @@ const WalletRoutes = () => {
<Route path='add-fund' element={<AddFund payment={paymentHistory} />} /> <Route path='add-fund' element={<AddFund payment={paymentHistory} />} />
<Route path='add-fund/confirm-add-fund' element={<ConfirmAddFund payment={paymentHistory} />} /> <Route path='add-fund/confirm-add-fund' element={<ConfirmAddFund payment={paymentHistory} />} />
<Route path='transfer-fund' element={<TransferFund payment={paymentHistory} wallet={walletList} />} /> <Route path='transfer-fund' element={<TransferFund payment={paymentHistory} wallet={walletList} />} />
<Route index element={<Balance coupon={couponHistory} wallet={walletList} />} /> <Route index element={<Balance wallet={walletList} />} />
<Route path='transfer-fund/add-recipient' element={<AddRecipient />} /> <Route path='transfer-fund/add-recipient' element={<AddRecipient />} />
<Route path='transfer-fund/confirm-transfer' element={<ConfirmTransfer payment={paymentHistory} wallet={walletList} />} /> <Route path='transfer-fund/confirm-transfer' element={<ConfirmTransfer payment={paymentHistory} wallet={walletList} />} />
<Route path='*' element={<Navigate to='/' />} /> <Route path='*' element={<Navigate to='/' />} />