-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.vue
55 lines (46 loc) · 1.11 KB
/
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
50
51
52
53
54
55
<template>
<v-app>
<v-sheet class="ma-auto pa-5" border rounded="xl">
<v-card-title class="text-h4">{{ getTitle() }}</v-card-title>
<v-card-text class="text-h6">{{ getDescription() }}</v-card-text>
</v-sheet>
</v-app>
</template>
<script setup lang="ts">
const i18n = useI18n();
const props = defineProps({
error: {
type: Object,
default: null,
},
});
useHead({
title: getTitle(),
});
onMounted(() => {
console.error(props.error.message);
});
/**
* Returns the title of the error message
*/
function getTitle(): string {
const key = "nuxt-bundle.error." + props.error.statusCode + ".title";
return i18n.te(key)
? i18n.t(key)
: i18n.t("nuxt-bundle.error.title", { error: props.error.statusCode });
}
/**
* Returns the description of the error message
*/
function getDescription(): string {
const key = "nuxt-bundle.error." + props.error.statusCode + ".description";
return i18n.te(key)
? i18n.t(key)
: i18n.t("nuxt-bundle.error.description", {
error: props.error.statusCode,
});
}
</script>
<style lang="scss">
@use "assets/style/main";
</style>