From ed59ac0e62a6fad1f4ce8424dc66cea670aef611 Mon Sep 17 00:00:00 2001 From: Dmitri Date: Wed, 1 Jul 2026 16:49:49 +0200 Subject: [PATCH] Fix frontend form factory action types --- frontend/src/factories/createFormPage.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/src/factories/createFormPage.tsx b/frontend/src/factories/createFormPage.tsx index 2eadd41..48f639b 100644 --- a/frontend/src/factories/createFormPage.tsx +++ b/frontend/src/factories/createFormPage.tsx @@ -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[0]; +type FormThunkAction = (arg: Arg) => DispatchableAction; // Field types supported by the factory export type FormFieldType = @@ -61,9 +63,9 @@ interface FormPageConfig { singularTitle: string; mode: 'create' | 'edit'; sliceSelector: (state: RootState) => { [key: string]: T | T[] }; - fetchAction?: AsyncThunk; - createAction?: AsyncThunk; - updateAction?: AsyncThunk; + fetchAction?: FormThunkAction<{ id: string }>; + createAction?: FormThunkAction; + updateAction?: FormThunkAction<{ id: string; data: T }>; permission: string; initialValues: T; fields: FormFieldConfig[];