41 lines
696 B
TypeScript
41 lines
696 B
TypeScript
import { HttpError } from 'fresh'
|
|
import { define } from '../utils.ts'
|
|
|
|
export const handler = define.handlers({
|
|
GET() {
|
|
return { data: { title: 'Page non trouvée' } }
|
|
},
|
|
})
|
|
|
|
export default define.page(function ErrorPage(ctx) {
|
|
if (!(ctx.error instanceof HttpError)) {
|
|
return (
|
|
<div>
|
|
<h1>Uknown server error</h1>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
const status = ctx.error.status
|
|
|
|
if (status === 404) {
|
|
return (
|
|
<>
|
|
<div>
|
|
<h1>Erreur 404 - Page non trouvé</h1>
|
|
<p>
|
|
La page que vous recherché n'existe pas ou a été supprimée.
|
|
</p>
|
|
<a href='/'>Retourner à l'accueil</a>
|
|
</div>
|
|
</>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<div>
|
|
<h1>Uknown http error</h1>
|
|
</div>
|
|
)
|
|
})
|