Display video counts and total views from Bunny CDN in admin
Update client-side query to fetch Bunny.net stats and video data, and adjust server-side logic in routes.ts to correctly aggregate total video views and counts from storage. Replit-Commit-Author: Agent Replit-Commit-Session-Id: d7424866-83d1-4486-a212-ac12b4c7becf Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/d7424866-83d1-4486-a212-ac12b4c7becf/aPgXP9Q
This commit is contained in:
@@ -57,19 +57,19 @@ export default function BunnyAdminPage() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
// Fetch videos from Bunny.net
|
||||
const { data: videosData, isLoading } = useQuery<{ videos: Video[], total: number }>({
|
||||
const { data: videosData, isLoading } = useQuery({
|
||||
queryKey: ['/api/videos', searchTerm],
|
||||
queryFn: () => apiRequest('GET', `/api/videos?search=${searchTerm}&limit=100`),
|
||||
});
|
||||
|
||||
// Fetch Bunny.net statistics
|
||||
const { data: statsData } = useQuery<BunnyStats>({
|
||||
const { data: statsData } = useQuery({
|
||||
queryKey: ['/api/bunny/stats'],
|
||||
queryFn: () => apiRequest('GET', '/api/bunny/stats'),
|
||||
});
|
||||
|
||||
const videos: Video[] = videosData?.videos || [];
|
||||
const stats: BunnyStats = statsData || {
|
||||
const videos: Video[] = (videosData as any)?.videos || [];
|
||||
const stats: BunnyStats = (statsData as any) || {
|
||||
totalVideos: videos.length,
|
||||
totalViews: videos.reduce((sum: number, v: Video) => sum + v.views, 0),
|
||||
totalStorage: 0,
|
||||
|
||||
Reference in New Issue
Block a user