feat(web/m7-352): kind-aware createPlaylistsQuery + system-playlists-status helper
This commit is contained in:
@@ -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
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user