feat(web): add home/albums/artists API clients for M6a
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { createQuery } from '@tanstack/svelte-query';
|
||||
import { api } from './client';
|
||||
import { qk } from './queries';
|
||||
import type { HomePayload } from './types';
|
||||
|
||||
export async function listHome(): Promise<HomePayload> {
|
||||
return api.get<HomePayload>('/api/home');
|
||||
}
|
||||
|
||||
// staleTime = 60s — repeat home-page mounts within a minute reuse cached
|
||||
// data. Like-state changes, new plays, freshly-added albums surface on
|
||||
// the next refetch.
|
||||
export function createHomeQuery() {
|
||||
return createQuery({
|
||||
queryKey: qk.home(),
|
||||
queryFn: listHome,
|
||||
staleTime: 60_000
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user