import React, { useState, useEffect } from 'react'; import axios from 'axios'; import { Card } from '@/components/ui/card'; import { Separator } from '@/components/ui/separator'; import { apiConfig } from '@/config/api.config'; import { toast } from 'sonner'; const BASE_URL_CUSTOMER = apiConfig.service_customer; export default function CustomerWallet(customerid: any) { const [customerWallet, setCustomerWallet] = useState([]); if (!customerid) return ''; useEffect(() => { fetchCustomerWallet(); }, []); async function fetchCustomerWallet() { try { let getCustWallet = await axios.get(`${BASE_URL_CUSTOMER}/customer/wallet`, { params: { customerid: customerid } }); setCustomerWallet(getCustWallet.data.data.data); } catch (error: any) { // toast.error(error.message); toast.error(`Wallet Not Found`); } } return (

Wallet Member

{customerWallet.length ? (
{customerWallet.map((item:any, index) => ( ))}
No Name Balance Month Limit Credit Limit
{index+1} {item.wallet} {item.amount} {item.monthly_limit} {item.credit_limit}
) : (

No wallet

)}
); }