refactor create
path for /country
route
This commit is contained in:
@ -27,20 +27,21 @@ export const CityCreate = () => {
|
||||
render={({field}) => (
|
||||
<Autocomplete
|
||||
{...countryAutocompleteProps}
|
||||
{...field}
|
||||
value={countryAutocompleteProps.options.find((option) => option.code === field.value) || null}
|
||||
onChange={(_, value) => {
|
||||
field.onChange(value?.code || '')
|
||||
}}
|
||||
getOptionLabel={(item) => {
|
||||
return item?.code || ''
|
||||
return item ? item.code : ''
|
||||
}}
|
||||
isOptionEqualToValue={(option, value) => {
|
||||
return option.code === value?.code
|
||||
return option.id === value?.id
|
||||
}}
|
||||
renderInput={(params) => <TextField {...params} label="Country Code" margin="normal" variant="outlined" error={!!errors.country_code} helperText={(errors as any)?.country_code?.message} required />}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
<TextField
|
||||
{...register('name', {
|
||||
required: 'This field is required',
|
||||
|
Reference in New Issue
Block a user