forked from EnergySage/es-ds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEsErrorPage.vue
107 lines (105 loc) · 3.76 KB
/
EsErrorPage.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<template>
<div class="bg-gray-50">
<b-container class="py-500 py-lg-800">
<b-row>
<b-col
md="7"
class="my-500 mx-auto text-center">
<h1 class="post1 text-gray-600">
{{ errorShortMessage }}
</h1>
<p
id="msgError"
class="font-size-lg text-gray-600">
{{ errorLongMessage }}
</p>
</b-col>
</b-row>
<b-row>
<b-col
v-for="(item, index) in linkItems.errorLinks"
:key="index"
cols="6"
md="3">
<a
class="align-items-center d-flex flex-column justify-content-center text-center"
:href="item.link">
<div
class="bg-white d-flex justify-content-center mb-50 rounded-circle"
align-v="center">
<div
class="m-100 text-orange">
<component
:is="item.icon"
height="53px"
width="53px" />
</div>
</div>
<p class="'font-weight-bolder mb-200 mb-md-0'">{{ item.label }}</p>
</a>
</b-col>
</b-row>
</b-container>
</div>
</template>
<script lang="js">
import { getEsErrorPageContent } from '../lib-utils/index';
import IconCommunitySolar from '../lib-icons/icon-community-solar.vue';
import IconContactUs from '../lib-icons/icon-contact-us.vue';
import IconMarketplace from '../lib-icons/icon-marketplace.vue';
import IconInfoBlogPost from '../lib-icons/icon-info-blog-post.vue';
export default {
name: 'EsErrorPage',
components: {
IconCommunitySolar,
IconContactUs,
IconMarketplace,
IconInfoBlogPost,
},
props: {
errorType: {
type: String,
required: true,
},
},
data() {
return {
errorCodeToMessages: {
403: {
shortMessage: 'Access denied',
longMessage: "Oops! If you're seeing this message, there's a good chance you have cookies or "
+ 'referrers turned off in your browser.',
},
404: {
shortMessage: 'Page not found',
longMessage: 'Oops! We are terribly sorry, but there is nothing bright to see here.',
},
500: {
shortMessage: 'Internal server error',
longMessage: 'Oops! We are terribly sorry, but our server is not so bright today. '
+ 'Please try again.',
},
503: {
shortMessage: 'Service unavailable',
longMessage: 'The page you are requesting is temporarily unavailable.',
},
default: {
longMessage: 'Oops! Something went wrong!',
},
},
linkItems: getEsErrorPageContent(),
};
},
computed: {
messages() {
return this.errorCodeToMessages[this.errorType];
},
errorShortMessage() {
return this.messages?.shortMessage || this.errorType;
},
errorLongMessage() {
return this.messages?.longMessage || this.errorCodeToMessages.default.longMessage;
},
},
};
</script>