Update Usage.tsx
This commit is contained in:
@@ -11,17 +11,16 @@ export default function Usage() {
|
|||||||
const [limits, setLimits] = useState<LimitCard[]>([]);
|
const [limits, setLimits] = useState<LimitCard[]>([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [limitsLoading, setLimitsLoading] = useState(true);
|
const [limitsLoading, setLimitsLoading] = useState(true);
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadUsage();
|
loadUsage();
|
||||||
loadLimits();
|
loadLimits();
|
||||||
}, [currentPage]);
|
}, []);
|
||||||
|
|
||||||
const loadUsage = async () => {
|
const loadUsage = async () => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const response = await fetchCreditUsage({ page: currentPage });
|
const response = await fetchCreditUsage({ page: 1 });
|
||||||
setUsageLogs(response.results || []);
|
setUsageLogs(response.results || []);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
toast.error(`Failed to load usage logs: ${error.message}`);
|
toast.error(`Failed to load usage logs: ${error.message}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user