mirror of
https://github.com/tiennm99/litellm.git
synced 2026-06-25 13:16:58 +00:00
fix bug when viewing spend on ui
This commit is contained in:
@@ -43,8 +43,18 @@ const ViewUserSpend: React.FC<ViewUserSpendProps> = ({ userID, userRole, accessT
|
||||
if (userRole === "Admin") {
|
||||
try {
|
||||
const globalSpend = await getTotalSpendCall(accessToken);
|
||||
setSpend(globalSpend.spend);
|
||||
setMaxBudget(globalSpend.max_budget || null);
|
||||
if (globalSpend) {
|
||||
if (globalSpend.spend) {
|
||||
setSpend(globalSpend.spend);
|
||||
} else {
|
||||
setSpend(0.0);
|
||||
}
|
||||
if (globalSpend.max_budget) {
|
||||
setMaxBudget(globalSpend.max_budget);
|
||||
} else {
|
||||
setMaxBudget(0.0);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error fetching global spend data:", error);
|
||||
}
|
||||
@@ -63,7 +73,6 @@ const ViewUserSpend: React.FC<ViewUserSpendProps> = ({ userID, userRole, accessT
|
||||
<p className="text-tremor-default text-tremor-content dark:text-dark-tremor-content">Total Spend</p>
|
||||
<p className="text-3xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold">${roundedSpend}</p>
|
||||
|
||||
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user