Add MP3 URL import and analytics widgets

This commit is contained in:
Bot 2026-03-01 18:56:37 +01:00
parent e200087a73
commit 5a41b6a622
5 changed files with 380 additions and 19 deletions

View file

@ -1,4 +1,4 @@
import type { Sound, SoundsResponse, VoiceChannelInfo } from './types';
import type { AnalyticsResponse, Sound, SoundsResponse, VoiceChannelInfo } from './types';
const API_BASE = import.meta.env.VITE_API_BASE_URL || '/api';
@ -13,6 +13,12 @@ export async function fetchSounds(q?: string, folderKey?: string, categoryId?: s
return res.json();
}
export async function fetchAnalytics(): Promise<AnalyticsResponse> {
const res = await fetch(`${API_BASE}/analytics`);
if (!res.ok) throw new Error('Fehler beim Laden der Analytics');
return res.json();
}
// Kategorien
export async function fetchCategories() {
const res = await fetch(`${API_BASE}/categories`, { credentials: 'include' });