Use server actions instead of client-side API calls

This commit is contained in:
Darren Clarke 2024-08-05 23:31:15 +02:00
parent 5a3127dcb0
commit aa453954ed
30 changed files with 703 additions and 462 deletions

View file

@ -7,6 +7,7 @@ type AutocompleteProps = {
label: string;
options: any[];
formState: Record<string, any>;
updateFormState: (name: string, value: any) => void;
disabled?: boolean;
required?: boolean;
};
@ -16,18 +17,21 @@ export const Autocomplete: FC<AutocompleteProps> = ({
label,
options,
formState,
updateFormState,
disabled = false,
required = false,
}) => (
<AutocompleteInternal
disablePortal
options={options}
defaultValue={formState.values[name]}
value={formState.values[name] || ""}
onChange={(e: any) => updateFormState?.(name, e.target.id)}
fullWidth
size="small"
renderInput={(params) => (
<TextField
{...params}
name={name}
label={label}
disabled={disabled}
required={required}