// 常量 export const NWS_API_BASE = "https://api.weather.gov"; export const USER_AGENT = "weather-app/1.0"; export async function makeNWSRequest(url) { const headers = { // "User-Agent": USER_AGENT, // Accept: "application/geo+json", }; try { const response = await fetch(url); if (!response.ok) throw new Error("API request failed"); return await response.json(); } catch (error) { return null; } } export function formatAlert(feature) { const props = feature.properties; return ` Event: ${props.event || "Unknown"} Area: ${props.areaDesc || "Unknown"} Severity: ${props.severity || "Unknown"} Description: ${props.description || "No description available"} Instructions: ${props.instruction || "No specific instructions provided"} `; }