feat: implement root domain handling for nobat724.com to prevent city filtering
This commit is contained in:
+4
-5
@@ -25,7 +25,7 @@ export async function generateMetadata() {
|
||||
|
||||
async function Doctors({ searchParams }) {
|
||||
const awaitedSearchParams = await searchParams;
|
||||
const { matchedCity, matchedState } = await getStateInfo();
|
||||
const { matchedCity, matchedState, isRoot } = await getStateInfo();
|
||||
const API_URL = process.env.NEXT_PUBLIC_API_URL;
|
||||
|
||||
let doctors = null;
|
||||
@@ -35,14 +35,13 @@ async function Doctors({ searchParams }) {
|
||||
try {
|
||||
let newSearchParams = awaitedSearchParams;
|
||||
|
||||
// Conditional State
|
||||
// Conditional State — روی دامنهٔ ریشه (nobat724) فیلتر اعمال نمیشود.
|
||||
if (stateParams) newSearchParams.state = stateParams;
|
||||
else if (matchedState) newSearchParams.state = matchedState.name;
|
||||
else if (matchedState && !isRoot) newSearchParams.state = matchedState.name;
|
||||
|
||||
// Conditional City
|
||||
if (cityParams) newSearchParams.city = cityParams;
|
||||
else if (matchedCity && matchedCity.id !== "600")
|
||||
newSearchParams.city = matchedCity.name;
|
||||
else if (matchedCity && !isRoot) newSearchParams.city = matchedCity.name;
|
||||
|
||||
const params = buildDoctorParams(newSearchParams);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user