add error boundry

This commit is contained in:
2025-12-11 22:31:55 -03:00
parent 5a00ebfc19
commit 6556c3eabb
5 changed files with 17 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ import {
} from 'lucide-react'
import { Link } from 'react-router'
import { Suspense } from 'react'
import { ErrorBoundary } from 'react-error-boundary'
import {
Card,
@@ -77,7 +78,7 @@ export default function Route({ loaderData: { data } }: Route.ComponentProps) {
</BreadcrumbList>
</Breadcrumb>
<Await resolve={data}>
<Await resolve={data} errorElement={<div>Algo deu errado</div>}>
{({ enrolled, scheduled, sk, created_by }) => {
const succeed = enrolled.filter(
({ status }) => status === 'success'

View File

@@ -37,7 +37,6 @@ export async function loader({ params, request, context }: Route.LoaderArgs) {
})
if (!r.ok) {
console.log(r.status)
throw new Response(null, { status: r.status })
}