-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.vue
91 lines (78 loc) · 1.91 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<template>
<LayoutThemeContext>
<NuxtLayout class="content--no-bottom-padding">
<LayoutBreadcrumpsProvider :breadcrumbs="[]" />
<div class="error-page">
<span class="error-page__title">{{ $t('common.error') }}</span>
<h1 class="error-page__code">{{ error?.statusCode || 500 }}</h1>
<p class="error-page__text">
{{ error?.message || error?.statusMessage || t('error.text') }}
</p>
<LayoutButton class="error-page__button" @click="handleError">
{{ t('error.button') }}
</LayoutButton>
</div>
</NuxtLayout>
</LayoutThemeContext>
</template>
<i18n lang="json">
{
"pl": {
"error": {
"text": "Coś poszło nie tak.",
"button": "Wróć do strony głównej"
}
},
"en": {
"error": {
"text": "Something went wrong.",
"button": "Back to home"
}
}
}
</i18n>
<script setup>
const props = defineProps({
// eslint-disable-next-line vue/require-default-prop
error: Object,
})
const t = useLocalI18n()
const $t = useGlobalI18n()
const handleError = () => clearError({ redirect: '/' })
useSeoTitle(`${$t('common.error')} ${props.error?.statusCode || 500}`)
onMounted(() => {
// eslint-disable-next-line no-console
console.error(`Error ${props.error?.statusCode}`, props.error?.message, props.error?.stack)
})
</script>
<style lang="scss">
.error-page {
width: calc(100vw - 32px);
margin: 0 auto;
margin-top: 48px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: rem(14);
@media ($viewport-10) {
font-size: rem(20);
width: calc(100vw - 64px);
}
&__code {
font-size: rem(80);
line-height: rem(160);
margin: 24px 0;
color: var(--secondary-color);
&::first-letter {
margin-left: 0;
}
@media ($viewport-6) {
font-size: rem(200);
}
}
&__button {
margin-top: 24px;
}
}
</style>