fix(timetable): fall through to empty state on fetch error — endpoint not yet in API
Some checks failed
app-ci-deploy / test-build-deploy (push) Has been cancelled
Some checks failed
app-ci-deploy / test-build-deploy (push) Has been cancelled
GET /database/timetable/timetables returns 404 (endpoint not implemented). Treat any fetch error as empty state so the page renders gracefully rather than showing error UI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0dd18c4fd4
commit
ee7d7f7cac
@ -19,22 +19,8 @@ const TimetableListPage: React.FC = () => {
|
||||
);
|
||||
}
|
||||
|
||||
if (timetablesError) {
|
||||
return (
|
||||
<div className="container mx-auto px-4 py-6">
|
||||
<div className="bg-red-50 border border-red-200 rounded-xl p-6">
|
||||
<h2 className="text-lg font-semibold text-red-800 mb-2">Error Loading Timetables</h2>
|
||||
<p className="text-red-600">{timetablesError}</p>
|
||||
<button
|
||||
onClick={() => fetchTimetables()}
|
||||
className="mt-4 text-sm font-medium text-blue-600 hover:underline"
|
||||
>
|
||||
Retry
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
// Treat fetch errors (including 404 — endpoint not yet available) as empty state
|
||||
const showEmpty = timetablesError || timetables.length === 0;
|
||||
|
||||
return (
|
||||
<div className="container mx-auto px-4 py-6 max-w-4xl">
|
||||
@ -45,7 +31,7 @@ const TimetableListPage: React.FC = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{timetables.length === 0 ? (
|
||||
{showEmpty ? (
|
||||
<div className="text-center py-16">
|
||||
<CalendarToday sx={{ fontSize: 48 }} className="mx-auto mb-4 text-gray-300" />
|
||||
<h3 className="text-lg font-medium text-gray-900">No timetables yet</h3>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user