Fix frontend form factory action types

This commit is contained in:
Dmitri 2026-07-01 16:49:49 +02:00
parent c3cb2b5a3c
commit ed59ac0e62

View File

@ -21,8 +21,10 @@ import { SelectField } from '../components/SelectField';
import { SelectFieldMany } from '../components/SelectFieldMany';
import { SwitchField } from '../components/SwitchField';
import FormImagePicker from '../components/FormImagePicker';
import type { RootState } from '../stores/store';
import type { AsyncThunk } from '@reduxjs/toolkit';
import type { AppDispatch, RootState } from '../stores/store';
type DispatchableAction = Parameters<AppDispatch>[0];
type FormThunkAction<Arg> = (arg: Arg) => DispatchableAction;
// Field types supported by the factory
export type FormFieldType =
@ -61,9 +63,9 @@ interface FormPageConfig<T> {
singularTitle: string;
mode: 'create' | 'edit';
sliceSelector: (state: RootState) => { [key: string]: T | T[] };
fetchAction?: AsyncThunk<unknown, { id: string }, object>;
createAction?: AsyncThunk<unknown, T, object>;
updateAction?: AsyncThunk<unknown, { id: string; data: T }, object>;
fetchAction?: FormThunkAction<{ id: string }>;
createAction?: FormThunkAction<T>;
updateAction?: FormThunkAction<{ id: string; data: T }>;
permission: string;
initialValues: T;
fields: FormFieldConfig[];