fix(admin): correct api endpoint paths for transaction stats and sms balance
Deploy Canina / deploy (push) Successful in 31s
Deploy Canina / deploy (push) Successful in 31s
This commit is contained in:
1 parent
9d63f9a7a4
commit
32f8b8b656
3 files changed
+26
-19
No files matched your search
@@ -101,27 +101,28 @@ export default function Topbar({ toggleMenu }: TopbarProps) {
|
||||
const fetchLiveHealth = async () => {
|
||||
try {
|
||||
const [txStatsRes, smsRes] = await Promise.allSettled([
|
||||
api.get('/transactions/stats'),
|
||||
api.get('/admin/sms/balance'),
|
||||
api.get('/payment/admin/stats'),
|
||||
api.get('/settings/sms/credit'),
|
||||
]);
|
||||
|
||||
const updated: LiveMonitoringSummary = { ...monitoringData };
|
||||
|
||||
if (txStatsRes.status === 'fulfilled' && txStatsRes.value.data?.success) {
|
||||
const stats = txStatsRes.value.data.data;
|
||||
if (txStatsRes.status === 'fulfilled' && txStatsRes.value?.data) {
|
||||
const stats = txStatsRes.value.data;
|
||||
updated.zibal = {
|
||||
status: 'ONLINE',
|
||||
latencyMs: Math.floor(Math.random() * 20) + 35,
|
||||
todayVolume: stats?.todayVolume || 0,
|
||||
todayVolume: stats?.todayVolume ? Math.floor(Number(stats.todayVolume)) : 0,
|
||||
};
|
||||
}
|
||||
|
||||
if (smsRes.status === 'fulfilled' && smsRes.value.data?.success) {
|
||||
const smsData = smsRes.value.data.data;
|
||||
if (smsRes.status === 'fulfilled' && smsRes.value?.data) {
|
||||
const smsData = smsRes.value.data;
|
||||
const creditVal = typeof smsData === 'object' ? smsData.credit || smsData.balance || smsData.data : smsData;
|
||||
updated.melipayamak = {
|
||||
status: 'ONLINE',
|
||||
latencyMs: Math.floor(Math.random() * 25) + 50,
|
||||
credit: Number(smsData?.balance || smsData?.credit || 0),
|
||||
credit: Number(creditVal || 0),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -131,6 +132,7 @@ export default function Topbar({ toggleMenu }: TopbarProps) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
fetchLiveHealth();
|
||||
const interval = setInterval(fetchLiveHealth, 45000);
|
||||
|
||||
Reference in new issue
Block a user