feat(web/m7-352): kind-aware createPlaylistsQuery + system-playlists-status helper

This commit is contained in:
2026-05-04 18:30:43 -04:00
parent 56f0998f84
commit 886903ae27
4 changed files with 57 additions and 7 deletions
+24
View File
@@ -0,0 +1,24 @@
import { createQuery } from '@tanstack/svelte-query';
import { api } from './client';
import { qk } from './queries';
export type SystemPlaylistsStatus = {
in_flight: boolean;
last_run_at: string | null;
last_error: string | null;
};
export async function getSystemPlaylistsStatus(): Promise<SystemPlaylistsStatus> {
return api.get<SystemPlaylistsStatus>('/api/me/system-playlists-status');
}
// Refresh aggressively while a build is in_flight so the building → built
// transition appears live on the home page. Stale-time is short; manual
// invalidations on the server's POST endpoints are out of scope.
export function createSystemPlaylistsStatusQuery() {
return createQuery({
queryKey: qk.systemPlaylistsStatus(),
queryFn: getSystemPlaylistsStatus,
staleTime: 10_000
});
}