diff --git a/components/dashboard/src/teams/TeamUsage.tsx b/components/dashboard/src/teams/TeamUsage.tsx
index ccceb82c9d4a5a..d0ab5e247e5d66 100644
--- a/components/dashboard/src/teams/TeamUsage.tsx
+++ b/components/dashboard/src/teams/TeamUsage.tsx
@@ -16,6 +16,7 @@ import Pagination from "../components/Pagination";
import Header from "../components/Header";
import { ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error";
import { FeatureFlagContext } from "../contexts/FeatureFlagContext";
+import { ReactComponent as CreditsSvg } from "../images/credits.svg";
function TeamUsage() {
const { teams } = useContext(TeamsContext);
@@ -28,8 +29,9 @@ function TeamUsage() {
const [errorMessage, setErrorMessage] = useState("");
const today = new Date();
const startOfCurrentMonth = new Date(today.getFullYear(), today.getMonth(), 1);
- const timestampOfStart = startOfCurrentMonth.getTime();
- const [startDateOfBillMonth] = useState(timestampOfStart);
+ const timestampStartOfCurrentMonth = startOfCurrentMonth.getTime();
+ const [startDateOfBillMonth, setStartDateOfBillMonth] = useState(timestampStartOfCurrentMonth);
+ const [endDateOfBillMonth, setEndDateOfBillMonth] = useState(Date.now());
useEffect(() => {
if (!team) {
@@ -40,8 +42,8 @@ function TeamUsage() {
try {
const billedUsageResult = await getGitpodService().server.listBilledUsage(
attributionId,
- startDateOfBillMonth, // TODO: set based on selected month
- Date.now(), // TODO: set based on selected month
+ startDateOfBillMonth,
+ endDateOfBillMonth,
);
setBilledUsage(billedUsageResult);
} catch (error) {
@@ -50,7 +52,7 @@ function TeamUsage() {
}
}
})();
- }, [team]);
+ }, [team, startDateOfBillMonth, endDateOfBillMonth]);
if (!showUsageBasedPricingUI) {
return
{errorMessage}
} {!errorMessage && (