ui/api: simplify types in api
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user