feat: add dashboard refresh buttons

This commit is contained in:
2026-04-22 15:37:47 -04:00
parent fb32a66996
commit 65ae7a6924
2 changed files with 21 additions and 7 deletions
+15 -6
View File
@@ -3,6 +3,7 @@
import { useEffect, useState } from "react";
import { useRouter } from "next/navigation";
import { toast } from "sonner";
import { RefreshCw } from "lucide-react";
import {
Card,
CardContent,
@@ -86,11 +87,8 @@ export default function DashboardPage() {
try {
const costsRes = await overseerApi.getCosts();
setRequestCosts(costsRes.data);
} catch {
/* ignore */
}
} catch {}
};
const handleLogout = async () => {
try {
await authApi.logout();
@@ -98,13 +96,20 @@ export default function DashboardPage() {
logout();
router.push("/login");
};
const handleRefresh = () => {
loadWalletAndPending();
loadCosts();
};
if (isLoading) return <div className="p-8">Loading...</div>;
return (
<div className="p-8 space-y-6">
<div className="flex items-center justify-between">
<div />
<Button variant="outline" onClick={handleRefresh}>
<RefreshCw className="mr-2 h-4 w-4" />
Refresh
</Button>
<Button variant="outline" onClick={handleLogout}>
Logout
</Button>
@@ -137,10 +142,14 @@ export default function DashboardPage() {
</div>
</div>
</div>
<div className="mt-4">
<div className="mt-4 flex gap-2">
<Button onClick={() => setIsSearchModalOpen(true)}>
Request content
</Button>
<Button variant="secondary" onClick={handleRefresh}>
<RefreshCw className="mr-2 h-4 w-4" />
Check requests
</Button>
</div>
</CardContent>
</Card>