ui/api: simplify types in api

This commit is contained in:
Johannes Kirschbauer
2025-08-11 11:00:30 +02:00
parent 1524dc963e
commit 0859a86ce0
2 changed files with 9 additions and 10 deletions

View File

@@ -72,7 +72,7 @@ export const callApi = <K extends OperationNames>(
const op_key = backendOpts?.op_key ?? crypto.randomUUID();
const req: BackendSendType<OperationNames> = {
const req: BackendSendType<K> = {
body: args,
header: {
...backendOpts,
@@ -83,11 +83,9 @@ export const callApi = <K extends OperationNames>(
const result = (
window as unknown as Record<
OperationNames,
(
args: BackendSendType<OperationNames>,
) => Promise<BackendReturnType<OperationNames>>
(args: BackendSendType<K>) => Promise<BackendReturnType<K>>
>
)[method](req) as Promise<BackendReturnType<K>>;
)[method](req);
return {
uuid: op_key,

View File

@@ -2,6 +2,7 @@ import { Typography } from "@/src/components/Typography/Typography";
import { BackButton, NextButton, StepLayout } from "../../Steps";
import {
createForm,
FieldValues,
getError,
SubmitHandler,
valiForm,
@@ -12,7 +13,7 @@ import { getStepStore, useStepper } from "@/src/hooks/stepper";
import { InstallSteps, InstallStoreType, PromptValues } from "../install";
import { TextInput } from "@/src/components/Form/TextInput";
import { Alert } from "@/src/components/Alert/Alert";
import { For, onMount, Show } from "solid-js";
import { For, Show } from "solid-js";
import { Divider } from "@/src/components/Divider/Divider";
import { Orienter } from "@/src/components/Form/Orienter";
import { Button } from "@/src/components/Button/Button";
@@ -302,19 +303,19 @@ const ConfigureData = () => {
);
};
type PromptGroup = {
interface PromptGroup {
name: string;
fields: {
prompt: Prompt;
generator: string;
value?: string | null;
}[];
};
}
type Prompt = NonNullable<MachineGenerators[number]["prompts"]>[number];
type PromptForm = {
interface PromptForm extends FieldValues {
promptValues: PromptValues;
};
}
interface PromptsFieldsProps {
generators: MachineGenerators;