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)
|
setLoading(true)
|
||||||
Promise.all([
|
Promise.all([
|
||||||
api.listSleep(30),
|
api.listSleep(30),
|
||||||
api.getSleepStats(7)
|
api.getSleepStats(7).catch(() => null) // Stats optional - don't fail if error
|
||||||
]).then(([sleepData, statsData]) => {
|
]).then(([sleepData, statsData]) => {
|
||||||
setSleep(sleepData)
|
setSleep(sleepData)
|
||||||
setStats(statsData)
|
setStats(statsData)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user