fix: make sleep stats optional to prevent page crash
If stats endpoint fails, page will still load with empty stats. This prevents 500 errors from blocking the entire sleep page. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
836bc4294b
commit
9e4d6fa715
|
|
@ -44,7 +44,7 @@ export default function SleepPage() {
|
|||
setLoading(true)
|
||||
Promise.all([
|
||||
api.listSleep(30),
|
||||
api.getSleepStats(7)
|
||||
api.getSleepStats(7).catch(() => null) // Stats optional - don't fail if error
|
||||
]).then(([sleepData, statsData]) => {
|
||||
setSleep(sleepData)
|
||||
setStats(statsData)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user