cbb703341e
Slice 4b frontend half. Jellyfin-touching pages now select a Jellyfin service instance instead of a machine. - api/client.ts: Jellyfin-backed calls (counts/libraries/activity/users, media status/build/stop/force-stop, queryMedia) send jellyfin_service_id. - hooks/useDashboard, useUsers, useMedia: selector param renamed to jellyfinServiceId. - pages/Media + Applications: list jellyfin service instances and persist jellyfin_service_id in the URL. - Dashboard (widgets) and Users (default instance) need no selector change. - Update Applications + Media tests for the new hook/param. Files/SSH transport keeps machine_id. Verification: frontend lint 0 errors, build success, 70 tests; backend ruff clean, 222 tests.
12 lines
378 B
TypeScript
12 lines
378 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { fetchUsers } from "../api/client";
|
|
import type { UserDirectoryResponse } from "../types";
|
|
|
|
export function useUsers(jellyfinServiceId?: string) {
|
|
return useQuery<UserDirectoryResponse>({
|
|
queryKey: ["users", jellyfinServiceId ?? "default"],
|
|
queryFn: () => fetchUsers(jellyfinServiceId),
|
|
staleTime: 30_000,
|
|
});
|
|
}
|