-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.vue
38 lines (33 loc) · 913 Bytes
/
error.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<script setup lang="ts">
import type { NuxtError } from '#app'
const props = defineProps({
error: Object as () => NuxtError,
})
const errorsMap: {
[key: string]: string
} = {
'400': 'Bad Request',
'401': 'Unauthorized',
'403': 'Forbidden',
'404': 'Not Found',
}
const err = computed(() => {
const code = props.error?.statusCode || -1
return {
code,
message: errorsMap[code.toString()] || 'Unknown Error',
}
})
useHead(() => ({
title: err.value.code + '-' + err.value.message,
}))
</script>
<template>
<div class="flex-1 relative py-8 flex flex-col items-center justify-center">
<h1 class="text-center mb-6 leading-3">
<span class="font-bold text-8xl block">{{ err.code }}</span>
<span class="block italic">{{ err.message }}</span>
</h1>
<Button text="Home" to="/" size="sm" />
</div>
</template>