-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.vue
30 lines (27 loc) · 971 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
<template>
<NuxtLayout>
<Container>
<h1 v-if="error.statusCode === 404">404 - page not found</h1>
<h1 v-else-if="error.statusCode === 400">400 - bad request</h1>
<h1 v-else>{{ error.statusCode }} - ERROR</h1>
<p>Oops! That page returns an</p>
<img src="/errorsAllTheWayDown.png" width="500" quality="50" alt="error" :title="error.message" />
<p v-if="newPath">
You might be looking for <NuxtLink :to="newPath">{{ newPath }}</NuxtLink>
</p>
<p v-else><NuxtLink to="/">Go home</NuxtLink></p>
<div v-if="debug">{{ error.message }}</div>
<div v-if="debug" v-html="error.stack"></div>
</Container>
</NuxtLayout>
</template>
<script setup>
const debug = process.env.NODE_ENV !== "production";
const route = useRoute();
var newPath = "";
let path = route.path;
if (path.includes("/blog")) newPath = path.replace("/blog", "/posts");
const { error } = defineProps({
error: Object,
});
</script>