fix(frontend): handle API errors gracefully

This commit is contained in:
2025-06-27 20:27:54 +01:00
parent 36163bda10
commit c580bda6ed
2 changed files with 28 additions and 2 deletions

View File

@@ -2,7 +2,20 @@ import { getPatterns } from "@/lib/api";
import Link from "next/link";
export default async function PatternsPage() {
const { items: patterns } = await getPatterns();
let patterns;
try {
const response = await getPatterns();
patterns = response.items;
} catch {
return (
<div className="space-y-6">
<h1 className="text-3xl font-bold">Algorithmic Patterns</h1>
<p className="text-[var(--muted-foreground)]">
Unable to load patterns. Please try again later.
</p>
</div>
);
}
return (
<div className="space-y-6">