fix(folders): API-Filter per folder + UI ruft Sounds je aktivem Tab ab; 'Alle' zeigt weiterhin alle
This commit is contained in:
parent
f9bec8b5a1
commit
1f0911c0f7
3 changed files with 9 additions and 3 deletions
|
|
@ -30,14 +30,14 @@ export default function App() {
|
|||
|
||||
const interval = setInterval(async () => {
|
||||
try {
|
||||
const s = await fetchSounds(query);
|
||||
const s = await fetchSounds(query, activeFolder);
|
||||
setSounds(s.items);
|
||||
setTotal(s.total);
|
||||
setFolders(s.folders);
|
||||
} catch {}
|
||||
}, 10000);
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
}, [activeFolder]);
|
||||
|
||||
const filtered = useMemo(() => {
|
||||
const q = query.trim().toLowerCase();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ const API_BASE = import.meta.env.VITE_API_BASE_URL || '/api';
|
|||
export async function fetchSounds(q?: string, folderKey?: string): Promise<SoundsResponse> {
|
||||
const url = new URL(`${API_BASE}/sounds`, window.location.origin);
|
||||
if (q) url.searchParams.set('q', q);
|
||||
if (folderKey) url.searchParams.set('folder', folderKey);
|
||||
const res = await fetch(url.toString());
|
||||
if (!res.ok) throw new Error('Fehler beim Laden der Sounds');
|
||||
return res.json();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue