After correcting the issue for bonus fund credit for BEP203
This commit is contained in:
parent
b68b380455
commit
9a2c88862e
@ -253,6 +253,7 @@ export function ReferralAdminPage() {
|
||||
setFundForm({ amountDisplay: '' });
|
||||
setFundPendingMsg(res.data.message ?? t('admin.referralAdmin.fundPending'));
|
||||
void qc.invalidateQueries({ queryKey: ['admin-referral-config'] });
|
||||
void qc.invalidateQueries({ queryKey: ['admin-fund-requests'] });
|
||||
},
|
||||
onError: (err: unknown) => {
|
||||
setFundPendingMsg(null);
|
||||
|
||||
@ -601,6 +601,7 @@ export function SecurityAdminPage() {
|
||||
void qc.invalidateQueries({ queryKey: ['admin-ledger-credits'] });
|
||||
setCreditsPage(0);
|
||||
void qc.invalidateQueries({ queryKey: ['admin-users'] });
|
||||
void qc.invalidateQueries({ queryKey: ['admin-fund-requests'] });
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -448,6 +448,7 @@ export function TreasuryAdminPage() {
|
||||
setPendingMsg(res.data.message ?? t('admin.treasury.sweepPending'));
|
||||
void qc.invalidateQueries({ queryKey: ['admin-treasury-sweeps'] });
|
||||
void qc.invalidateQueries({ queryKey: ['admin-treasury-overview'] });
|
||||
void qc.invalidateQueries({ queryKey: ['admin-fund-requests'] });
|
||||
},
|
||||
});
|
||||
|
||||
@ -498,6 +499,7 @@ export function TreasuryAdminPage() {
|
||||
setPendingMsg(res.data.message ?? t('admin.treasury.gasPending'));
|
||||
void qc.invalidateQueries({ queryKey: ['admin-treasury-overview'] });
|
||||
void qc.invalidateQueries({ queryKey: ['admin-treasury-gas-preview'] });
|
||||
void qc.invalidateQueries({ queryKey: ['admin-fund-requests'] });
|
||||
setGasForm((f) => ({ ...f, amount: '', notes: '' }));
|
||||
setGasError(null);
|
||||
},
|
||||
|
||||
@ -441,6 +441,9 @@ export function UserManagementPage() {
|
||||
setBatchBonusForm({ amountDisplay: '', reason: '', adjustmentType: 'bonus' });
|
||||
setRowSelection({ type: 'include', ids: new Set() });
|
||||
void qc.invalidateQueries({ queryKey: ['admin-users'] });
|
||||
if (batchDialog === 'bonus') {
|
||||
void qc.invalidateQueries({ queryKey: ['admin-fund-requests'] });
|
||||
}
|
||||
const failed = data.failed?.length ?? 0;
|
||||
const ok = data.succeeded?.length ?? 0;
|
||||
setToast(failed ? `${ok} succeeded, ${failed} failed` : `${ok} user(s) updated`);
|
||||
|
||||
@ -126,8 +126,22 @@ export function AppShell() {
|
||||
refetchInterval: 15_000,
|
||||
});
|
||||
|
||||
// No polling: refresh on mount/focus and whenever a mutation invalidates ['admin-fund-requests'].
|
||||
const pendingApprovalsQ = useQuery({
|
||||
queryKey: ['admin-fund-requests', 'pending-count'],
|
||||
queryFn: async () => {
|
||||
const res = await api.get<{ total: number }>('/api/v1/admin/fund-requests', {
|
||||
params: { status: 'pending_approval', limit: 1 },
|
||||
});
|
||||
return res.data.total;
|
||||
},
|
||||
enabled: canApproveFundOps,
|
||||
staleTime: 30_000,
|
||||
});
|
||||
|
||||
const unreadNotifications = notificationsQ.data ?? 0;
|
||||
const unreadSupport = supportUnreadQ.data ?? 0;
|
||||
const pendingApprovals = pendingApprovalsQ.data ?? 0;
|
||||
|
||||
useEffect(() => {
|
||||
if (!isMdUp) {
|
||||
@ -187,7 +201,15 @@ export function AppShell() {
|
||||
: []),
|
||||
...(canApproveFundOps
|
||||
? [
|
||||
{ label: t('nav.approvals'), to: '/admin/approvals', icon: <GavelRoundedIcon /> },
|
||||
{
|
||||
label: t('nav.approvals'),
|
||||
to: '/admin/approvals',
|
||||
icon: (
|
||||
<Badge color="error" badgeContent={pendingApprovals} invisible={pendingApprovals === 0}>
|
||||
<GavelRoundedIcon />
|
||||
</Badge>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: t('nav.approvalPolicies'),
|
||||
to: '/admin/approval-policies',
|
||||
@ -197,7 +219,7 @@ export function AppShell() {
|
||||
: []),
|
||||
...(hasAdminPanel || isAdmin ? adminNavItems : []),
|
||||
] as const,
|
||||
[t, isAdmin, hasAdminPanel, isStaff, canApproveFundOps, unreadSupport, adminNavItems]
|
||||
[t, isAdmin, hasAdminPanel, isStaff, canApproveFundOps, unreadSupport, pendingApprovals, adminNavItems]
|
||||
);
|
||||
|
||||
const drawer = (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user