fix: mood TypeError crash + absolute fallback path in post.js
This commit is contained in:
parent
bb2aecd9b8
commit
a40c91aa3f
1 changed files with 2 additions and 2 deletions
|
|
@ -119,7 +119,7 @@
|
||||||
const el = document.getElementById('postStats');
|
const el = document.getElementById('postStats');
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
|
|
||||||
const moodStr = (post.mood || 'focused').toLowerCase();
|
const moodStr = String(post.mood || 'focused').toLowerCase();
|
||||||
const moodIcon = moodIcons[moodStr] || '◈';
|
const moodIcon = moodIcons[moodStr] || '◈';
|
||||||
const moodColor = moodColors[moodStr] || '#d0d0d0';
|
const moodColor = moodColors[moodStr] || '#d0d0d0';
|
||||||
const hr = post.heart_rate || post.bpm || 72;
|
const hr = post.heart_rate || post.bpm || 72;
|
||||||
|
|
@ -319,7 +319,7 @@
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Fallback: try static JSON
|
// Fallback: try static JSON
|
||||||
try {
|
try {
|
||||||
const res2 = await fetch('api/data/posts.json');
|
const res2 = await fetch('/api/data/posts.json');
|
||||||
const posts = await res2.json();
|
const posts = await res2.json();
|
||||||
const post = posts.find(p => p.slug === slug);
|
const post = posts.find(p => p.slug === slug);
|
||||||
if (!post) throw new Error('Not found');
|
if (!post) throw new Error('Not found');
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue