import { createQuery } from '@tanstack/svelte-query'; import { api } from './client'; import { qk } from './queries'; import type { HomePayload } from './types'; export async function listHome(): Promise { return api.get('/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 }); }