mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-04-20 03:50:20 +00:00
refactor: remove layout error component from dashboard
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m10s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m10s
This commit is contained in:
parent
4e16c0ac54
commit
bb5eff8b5b
@ -1,36 +0,0 @@
|
|||||||
'use client' // Error boundaries must be Client Components
|
|
||||||
|
|
||||||
import { Button } from '@/components/ui/button'
|
|
||||||
import { TriangleAlert } from "lucide-react";
|
|
||||||
import { useEffect } from 'react'
|
|
||||||
export default function DashboardError({
|
|
||||||
error,
|
|
||||||
reset,
|
|
||||||
}: {
|
|
||||||
error: Error & { digest?: string }
|
|
||||||
reset: () => void
|
|
||||||
}) {
|
|
||||||
useEffect(() => {
|
|
||||||
// Log the error to an error reporting service
|
|
||||||
console.error(error)
|
|
||||||
}, [error])
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='error-bg dark:error-bg-dark rounded-lg p-4 h-full flex flex-col gap-4 items-center justify-center'>
|
|
||||||
<div className='bg-white dark:bg-transparent p-6 rounded flex flex-col items-center justify-center gap-4'>
|
|
||||||
<TriangleAlert color='red' />
|
|
||||||
<h2 className='text-red-500 text-xl font-semibold'>Something went wrong!</h2>
|
|
||||||
<Button
|
|
||||||
variant={"destructive"}
|
|
||||||
size={"lg"}
|
|
||||||
onClick={
|
|
||||||
// Attempt to recover by trying to re-render the segment
|
|
||||||
() => reset()
|
|
||||||
}
|
|
||||||
>
|
|
||||||
Try again
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user