chore: install project dependencies and generate build artifacts.

This commit is contained in:
2569718930@qq.com
2026-03-06 08:41:19 +08:00
parent b210dcf0dd
commit dc4167b514
28 changed files with 4143 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import type { CityDetail, CitySummary } from "@/lib/types";
export async function getCities(): Promise<CitySummary[]> {
const res = await fetch("/api/cities", { cache: "no-store" });
if (!res.ok) {
throw new Error(`Failed to load cities: ${res.status}`);
}
const data = await res.json();
return data.cities ?? [];
}
export async function getCityDetail(
cityName: string,
forceRefresh = false,
): Promise<CityDetail> {
const slug = cityName.replace(/\s/g, "-");
const res = await fetch(
`/api/city/${encodeURIComponent(slug)}?force_refresh=${forceRefresh}`,
{
cache: "no-store",
},
);
if (!res.ok) {
throw new Error(`Failed to load city detail: ${res.status}`);
}
return await res.json();
}