handle request in modal filters, selector sort, search city with one function and field-search & handle change all data in doctors filter with one function & change modal search location in home page & set data with diffrent key in url of page doctors

This commit is contained in:
Ehsan
2025-09-12 20:51:50 +03:30
parent dbef29b9d9
commit 6414293d1c
19 changed files with 385 additions and 409 deletions
+21
View File
@@ -0,0 +1,21 @@
// lib/getStateInfoClient.js
import citiesData from "@/data/city.json";
import statesData from "@/data/state.json";
export function getStateInfoClient() {
if (typeof window === "undefined")
return { matchedCity: null, matchedState: null };
const host = window.location.host || "";
const subdomain = host.split(".")[0];
const matchedCity = citiesData.find((city) =>
city.domain.includes(subdomain)
);
const matchedState =
matchedCity &&
statesData.find((state) => state.id === matchedCity.province_id);
return { matchedCity, matchedState };
}