Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/features/CitySelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const CitySelect = ({
autocompletionRequest: {
types:
countryRestrictions === "IT"
? ["administrative_level_area_3"]
? ["administrative_area_level_3"]
: ["(cities)"],
componentRestrictions: { country: countryRestrictions || "" },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
SelectType,
} from "@appquality/appquality-design-system";
import { FieldProps } from "formik";
import CountrySelect from "src/features/CountrySelect";
import CitySelect from "src/features/CitySelect";
import { useTranslation } from "react-i18next";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import CitySelect from "src/features/CitySelect";
import CountrySelect from "src/features/CountrySelect";

interface AddressFieldsProps {
label: string;
Expand Down Expand Up @@ -70,9 +70,15 @@ export const AddressFields = ({
return;
}
const fields = place.address_components;
const city = fields.find(
(field) => field.types.indexOf("locality") >= 0
let city = fields.find(
(field) =>
field.types.indexOf("administrative_area_level_3") >= 0
);
if (!city) {
city = fields.find(
(field) => field.types.indexOf("locality") >= 0
);
}
if (!city) {
form.setFieldError(
cityField,
Expand Down
10 changes: 8 additions & 2 deletions src/pages/Profile/TabBase/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,15 @@ const TabBase = () => {
return;
}
const fields = place.address_components;
const city = fields.find(
(field) => field.types.indexOf("locality") >= 0
let city = fields.find(
(field) =>
field.types.indexOf("administrative_area_level_3") >= 0
);
if (!city) {
city = fields.find(
(field) => field.types.indexOf("locality") >= 0
);
}
if (!city) {
formikProps.setFieldError(
"city",
Expand Down
Loading