chore(ui): finish simplifying clan query params

This commit is contained in:
Brian McGee
2025-07-22 17:32:40 +01:00
parent 1510b4014b
commit 9706285474
2 changed files with 3 additions and 7 deletions

View File

@@ -2,20 +2,16 @@ import { useQuery, UseQueryResult } from "@tanstack/solid-query";
import { callApi, SuccessData } from "../hooks/api";
export type ListMachines = SuccessData<"list_machines">;
export type MachinesQueryResult = UseQueryResult<ListMachines>;
interface MachinesQueryParams {
clanURI: string | null;
clanURI: string;
}
export const useMachinesQuery = (props: MachinesQueryParams) =>
useQuery<ListMachines>(() => ({
queryKey: ["clans", props.clanURI, "machines"],
enabled: !!props.clanURI,
queryFn: async () => {
if (!props.clanURI) {
return {};
}
const api = callApi("list_machines", {
flake: {
identifier: props.clanURI,

View File

@@ -221,7 +221,7 @@ const ClanSceneController = () => {
};
const SceneDataProvider = (props: {
clanURI: string | null;
clanURI: string;
children: (sceneData: { query: MachinesQueryResult }) => JSX.Element;
}) => {
const machinesQuery = useMachinesQuery({ clanURI: props.clanURI });