feat: implement root domain handling for nobat724.com to prevent city filtering
This commit is contained in:
+4
-1
@@ -4,6 +4,9 @@ import { headers } from "next/headers";
|
||||
import citiesData from "@/data/city.json";
|
||||
import statesData from "@/data/state.json";
|
||||
|
||||
import { ROOT_CITY_ID, isRootCity } from "@/lib/rootCity";
|
||||
export { ROOT_CITY_ID, isRootCity };
|
||||
|
||||
export async function getStateInfo() {
|
||||
const headersList = await headers();
|
||||
|
||||
@@ -20,5 +23,5 @@ export async function getStateInfo() {
|
||||
matchedCity &&
|
||||
statesData.find((state) => state.id === matchedCity.province_id);
|
||||
|
||||
return { matchedCity, matchedState };
|
||||
return { matchedCity, matchedState, isRoot: isRootCity(matchedCity) };
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// رکورد nobat724.com در city.json دامنهٔ ریشه/مخزنِ همهٔ شهرهاست، نه یک شهر.
|
||||
// این ماژول pure است (بدون next/headers) تا در client و server هر دو قابل import باشد.
|
||||
export const ROOT_CITY_ID = 600;
|
||||
|
||||
export const isRootCity = (c) => c != null && Number(c.id) === ROOT_CITY_ID;
|
||||
Reference in New Issue
Block a user