-
Notifications
You must be signed in to change notification settings - Fork 1
/
error.vue
49 lines (40 loc) · 995 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
43
44
45
46
47
48
49
<template>
<NuxtLayout>
<section class="l-main-content-section c-error">
<h2 class="c-error__title">{{ title }}</h2>
<img class="c-error__image" src="/images/error-illustration.jpg" :alt="$t('error.imageDescription')" />
<nuxt-link :to="localePath('/')">{{ $t('backHome') }}</nuxt-link>
</section>
</NuxtLayout>
</template>
<script setup lang="ts">
import type { NuxtError } from '#app';
const { t } = useI18n();
const localePath = useLocalePath();
const props = defineProps({
error: {
type: Object as () => NuxtError,
default: null,
},
});
const title = computed(() => {
return props.error.statusCode === 404 ? t('error.pageNotFound') : t('error.otherError');
});
useHead({
title: () => title.value,
});
console.error(props.error);
</script>
<style scoped>
.c-error {
text-align: center;
}
.c-error__image {
display: block;
max-width: 100%;
margin: auto;
}
.c-error__title {
margin-bottom: var(--st-length-spacing-s);
}
</style>