Fix NWS alerts not showing when no location is configured
Publish Container / publish (push) Successful in 1m55s
Publish Container / publish (push) Successful in 1m55s
- Show a prompt linking to Settings instead of silently hiding the alerts section when no lat/lon is saved - Clear the alert cache when location is saved so alerts appear immediately without waiting for the 5-minute cache to expire Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
47f60e72f7
commit
5f7e490a6e
2 files changed
+6
No files matched your search
@@ -1334,6 +1334,11 @@ async function loadAlerts() {
|
||||
const r = await fetch('/api/dashboard/alerts');
|
||||
if (!r.ok) return;
|
||||
const data = await r.json();
|
||||
if (data.noLocation) {
|
||||
section.style.marginBottom = '1rem';
|
||||
section.innerHTML = '<div class="alert-card sev-unknown" style="font-size:0.85rem">⚠ No location set — <a href="/dashboard/settings" style="color:var(--cool)">add your coordinates in Settings</a> to see NWS alerts.</div>';
|
||||
return;
|
||||
}
|
||||
const features = data.features || [];
|
||||
if (!features.length) { section.innerHTML = ''; section.style.marginBottom = '0'; return; }
|
||||
section.style.marginBottom = '1rem';
|
||||
|
||||
@@ -1344,6 +1344,7 @@ app.post('/api/dashboard/location', requireDashboardAuth, (req, res) => {
|
||||
return res.status(400).json({ error: 'Invalid coordinates' });
|
||||
dashAuth = { ...dashAuth, stationLat: +lat, stationLon: +lon };
|
||||
try { fs.writeFileSync(DASH_AUTH_FILE, JSON.stringify(dashAuth)); } catch {}
|
||||
dashAlertCache.clear();
|
||||
res.json({ ok: true });
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user