feat: implement root domain handling for nobat724.com to prevent city filtering
This commit is contained in:
@@ -11,18 +11,19 @@ import { useSearchParams } from "next/navigation";
|
||||
// Data
|
||||
import states from "@/data/state.json";
|
||||
import cities from "@/data/city.json";
|
||||
import { isRootCity } from "@/lib/rootCity";
|
||||
|
||||
function ClinicsPage({ clinics, matchedCity, matchedState }) {
|
||||
const searchParams = useSearchParams();
|
||||
const [page, setPage] = useState(clinics?.meta?.currentPage || 1);
|
||||
const [filteredClinics, setFilteredClinics] = useState(clinics?.data);
|
||||
|
||||
const selectedState = searchParams.get("state") || matchedState?.name;
|
||||
const isRoot = isRootCity(matchedCity);
|
||||
const selectedState =
|
||||
searchParams.get("state") || (!isRoot ? matchedState?.name : undefined);
|
||||
const selectedCity =
|
||||
searchParams.get("city") ||
|
||||
(matchedCity?.name && matchedCity?.id !== "600"
|
||||
? matchedCity?.name
|
||||
: false);
|
||||
(matchedCity?.name && !isRoot ? matchedCity?.name : false);
|
||||
|
||||
const [selected, setSelected] = useState({
|
||||
province:
|
||||
|
||||
@@ -7,6 +7,7 @@ import Head from "./head";
|
||||
import specialties from "@/data/specialties.json";
|
||||
import states from "@/data/state.json";
|
||||
import cities from "@/data/city.json";
|
||||
import { isRootCity } from "@/lib/rootCity";
|
||||
|
||||
function DoctorsPage({ matchedCity, matchedState, list }) {
|
||||
const searchParams = useSearchParams();
|
||||
@@ -19,12 +20,12 @@ function DoctorsPage({ matchedCity, matchedState, list }) {
|
||||
const isParent =
|
||||
findItem("name", fieldName) && findItem("name", fieldName).parent_id;
|
||||
|
||||
const selectedState = searchParams.get("state") || matchedState?.name;
|
||||
const isRoot = isRootCity(matchedCity);
|
||||
const selectedState =
|
||||
searchParams.get("state") || (!isRoot ? matchedState?.name : undefined);
|
||||
const selectedCity =
|
||||
searchParams.get("city") ||
|
||||
(matchedCity?.name && matchedCity?.id !== "600"
|
||||
? matchedCity?.name
|
||||
: false);
|
||||
(matchedCity?.name && !isRoot ? matchedCity?.name : false);
|
||||
|
||||
const valCategory = isParent
|
||||
? findItem("id", isParent)
|
||||
|
||||
Reference in New Issue
Block a user