Files
hats-app/app/(dashboard)/error.tsx
T
2025-12-19 13:57:55 +07:00

35 lines
1.4 KiB
TypeScript

'use client'
import { useEffect } from "react"
import Image from "next/image"
import Link from "next/link"
import { Button } from "@/components/ui/button"
export default function Error({
error,
reset,
}: {
error: Error
reset: () => void
}) {
useEffect(() => {
console.log({ name: error.name, cause: error.cause, message: error.message, stack: error.stack })
}, [error])
return (
<>
<div className="h-[90vh] flex flex-col justify-center items-center overflow-x-hidden overflow-y-auto py-5">
<Image alt='ilustrations' height={0} width={0} quality={70} src='/assets/illustrations/maintenance.svg' className='w-80 md:w-md 2xl:w-160 shadow-sm rounded-full object-cover' />
<h2 className="text-xl sm:text-2xl font-semibold tracking-tight text-center">Oopps.. something went wrong!</h2>
<span className="text-center mt-1 mb-6 text-zinc-600 dark:text-zinc-400 md:w-9/12 break-all px-2 sm:px-0">{error.message || 'Sorry, system error has occurred'}</span>
<div className="flex items-center space-x-2">
<Button onClick={() => window.location.reload()} variant='secondary' className="w-28">Try Again</Button>
<Link href='/auth'>
<Button variant='outline' className="w-28">Login</Button>
</Link>
</div>
</div>
</>
)
}