add tracking statistic

This commit is contained in:
smanylov
2026-05-07 12:06:02 +07:00
parent 29546740c7
commit 07e1237f05
4 changed files with 101 additions and 11 deletions
+37 -1
View File
@@ -185,7 +185,43 @@ export async function fetchHistoryView(page: number, size: number) {
headers: {
'Content-Type': 'application/json'
}
});
});
if (response.ok) {
const parsed = await response.json();
if (parsed.message_code === 0) {
return parsed.message_body;
} else {
return null;
}
} else {
throw new Error(`${response.status}`);
}
} catch (error) {
return null;
}
}
export async function fetchTrackingStats() {
const token = await getSessionData('token');
try {
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
method: 'POST',
body: JSON.stringify({
version: 1,
msg_id: 30028,
message_body: {
token: token,
action: 'view_stats'
}
}),
headers: {
'Content-Type': 'application/json'
}
});
if (response.ok) {
const parsed = await response.json();