mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-29 18:13:47 +00:00
feat: local period calculation and refresh button for node usage
- Load panel + node data once on tab open (not per period change) - Compute 7/14/30 day totals locally from cached daily data - Add refresh button to subscription section - No API calls when switching periods
This commit is contained in:
@@ -134,10 +134,12 @@ export interface UserNodeUsageItem {
|
||||
node_name: string;
|
||||
country_code: string;
|
||||
total_bytes: number;
|
||||
daily_bytes: number[];
|
||||
}
|
||||
|
||||
export interface UserNodeUsageResponse {
|
||||
items: UserNodeUsageItem[];
|
||||
categories: string[];
|
||||
period_days: number;
|
||||
}
|
||||
|
||||
@@ -545,11 +547,9 @@ export const adminUsersApi = {
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// Get node usage
|
||||
getNodeUsage: async (userId: number, days = 7): Promise<UserNodeUsageResponse> => {
|
||||
const response = await apiClient.get(`/cabinet/admin/users/${userId}/node-usage`, {
|
||||
params: { days },
|
||||
});
|
||||
// Get node usage (always 30 days with daily breakdown)
|
||||
getNodeUsage: async (userId: number): Promise<UserNodeUsageResponse> => {
|
||||
const response = await apiClient.get(`/cabinet/admin/users/${userId}/node-usage`);
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user