feat(web): API client for /api/discover/suggestions

This commit is contained in:
2026-05-01 06:24:21 -04:00
parent ae2d69d378
commit 95b706836d
4 changed files with 75 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import { createQuery } from '@tanstack/svelte-query';
import { api } from './client';
import { qk } from './queries';
import type { ArtistSuggestion } from './types';
export async function listSuggestions(limit = 12): Promise<ArtistSuggestion[]> {
return api.get<ArtistSuggestion[]>(`/api/discover/suggestions?limit=${limit}`);
}
export function createSuggestionsQuery(limit = 12) {
return createQuery({
queryKey: qk.suggestions(limit),
queryFn: () => listSuggestions(limit),
staleTime: 5 * 60_000 // 5 minutes — see M5c spec §5
});
}