-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patherror.vue
42 lines (38 loc) · 919 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
39
40
41
42
<template>
<theme-wrapper>
<message-layout>
<h1>
{{ title }}
</h1>
<div class="tw-space-y-2">
<p class="tw-text-dim-1">
{{ message }}
</p>
<div>
<a
class="tw-link"
role="button"
@click="clearError({ redirect: '/' })"
>
{{ $t('goHome') }}
</a>
</div>
</div>
</message-layout>
</theme-wrapper>
</template>
<script setup lang="ts">
const props = defineProps({
error: Object,
})
const { t } = useI18n()
const error = toRef(props, 'error')
const title = computed(() => error.value?.statusCode ?? t('errors.default'))
const message = computed(() => error.value?.statusCode === 404
? t('errors.notFound')
: t('errors.unexpected'),
)
useHead({
title: `var(--themage-error${error?.value?.statusCode ? `-${error.value.statusCode}` : ''})`,
})
</script>