import React, { useState, useEffect } from 'react'; import axios from 'axios'; import BankaCardBox from './BankaCardBox'; import KrediCardBox from './KrediCardBox'; import { FaWallet, FaChartPie } from 'react-icons/fa6'; const BASE_URL = "http://localhost:8000"; const Main = () => { const [users, setUsers] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const getAllByUsers = async () => { try { setLoading(true); const response = await axios.get(`${BASE_URL}/bank/accounts`); setUsers(response.data.data); } catch (error) { console.error("Error fetching data:", error); setError("Failed to load account data. Please try again later."); } finally { setLoading(false); } }; useEffect(() => { getAllByUsers(); }, []); if (loading) { return (