feat: add manual backfill button to admin
This commit is contained in:
@@ -121,6 +121,17 @@ export default function AdminPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const backfillUser = async (userId: string) => {
|
||||
toast.info("Scouring the barn for old eggs...");
|
||||
try {
|
||||
await adminApi.backfillUser(userId);
|
||||
toast.success("Backfill complete!");
|
||||
loadData();
|
||||
} catch {
|
||||
toast.error("Backfill failed");
|
||||
}
|
||||
};
|
||||
|
||||
const toggleAdmin = async (userId: string, isAdmin: boolean) => {
|
||||
try {
|
||||
await api.patch(`/admin/users/${userId}`, { isAdmin });
|
||||
@@ -263,6 +274,15 @@ export default function AdminPage() {
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
className="h-10 rounded-full font-black border-2 border-foreground"
|
||||
onClick={() => backfillUser(u.id)}
|
||||
>
|
||||
BACKFILL
|
||||
</Button>
|
||||
|
||||
<div className="h-10 w-px bg-foreground/10 mx-1 hidden sm:block" />
|
||||
|
||||
<Button
|
||||
@@ -426,7 +446,7 @@ export default function AdminPage() {
|
||||
</div>
|
||||
<div className="rounded-3xl border-4 border-foreground bg-card p-6 shadow-[6px_6px_0px_0px_rgba(0,0,0,1)]">
|
||||
<div className="text-xs font-black uppercase tracking-widest text-muted-foreground mb-2 flex items-center gap-2">
|
||||
<TrendingUp className="h-4 w-4" /> Requests
|
||||
<TrendingUp className="h-3 w-3" /> Requests
|
||||
</div>
|
||||
<div className="text-4xl font-black">
|
||||
{analytics?.requests.total || 0}
|
||||
|
||||
@@ -93,6 +93,7 @@ export const adminApi = {
|
||||
getAllTransactions: (page = 1, limit = 50) =>
|
||||
api.get(`/transactions/admin/all?page=${page}&limit=${limit}`),
|
||||
getSystemStats: () => api.get("/transactions/admin/stats"),
|
||||
backfillUser: (userId: string) => api.post(`/admin/users/${userId}/backfill`),
|
||||
};
|
||||
|
||||
// Overseer API
|
||||
|
||||
Reference in New Issue
Block a user