import WithdrawalsPageClient from "./WithdrawalsPageClient";

export default async function WithdrawalsPage() {
  const authToken = ""; // Fetch token from cookies if needed
  const [balancesRes, withdrawalsRes] = await Promise.all([
    fetch(`${process.env.NEXT_PUBLIC_API_URL}/balances`, {
      headers: { Authorization: `Bearer ${authToken}` },
    }),
    fetch(`${process.env.NEXT_PUBLIC_API_URL}/withdrawals`, {
      headers: { Authorization: `Bearer ${authToken}` },
    }),
  ]);

  const balances = balancesRes.ok ? await balancesRes.json() : {};
  const withdrawals = withdrawalsRes.ok ? await withdrawalsRes.json() : [];

  return <WithdrawalsPageClient balances={balances} withdrawals={withdrawals} />;
}