Use server actions instead of client-side API calls
This commit is contained in:
parent
5a3127dcb0
commit
aa453954ed
30 changed files with 703 additions and 462 deletions
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue