soulsync/webui/src/platform/shell/status.ts
Antti Kettunen fec66e4de8
feat(webui): expose shell status in root context
- add a shared shell client and root /status query
- attach shell status to the TanStack root context for React routes
- keep the shell bridge types and test setup aligned with the new status data
2026-05-23 21:23:32 +03:00

25 lines
641 B
TypeScript

import { queryOptions } from '@tanstack/react-query';
import { readJson, shellClient } from '@/app/api-client';
export interface ShellStatusMediaServer {
type?: string | null;
connected?: boolean | null;
}
export interface ShellStatusPayload {
media_server?: ShellStatusMediaServer | null;
}
export async function fetchShellStatus(): Promise<ShellStatusPayload> {
return await readJson<ShellStatusPayload>(shellClient.get('status'));
}
export function shellStatusQueryOptions() {
return queryOptions({
queryKey: ['shell', 'status'] as const,
queryFn: fetchShellStatus,
staleTime: 30_000,
retry: false,
});
}