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[];