forked from nuxt/movies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.vue
30 lines (27 loc) · 859 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
<script setup>
const props = defineProps({
error: Object,
})
const message = computed(() => String(props.error?.message || ''))
const is404 = computed(() => props.error?.statusCode === 404 || message.value?.includes('404'))
const isDev = process.dev
function handleError() {
return clearError({ redirect: '/' })
}
</script>
<template>
<NuxtLayout>
<div flex="~ col" h-screen text-center items-center justify-center gap4>
<div text-3xl>
{{ is404 ? 'This page could not be found' : 'An error occurred' }}
</div>
<div text-xl op50>
Looks like you've followed a broken link or entered a URL that doesn't exist on this site.
</div>
<pre v-if="isDev">{{ error }}</pre>
<button n-link border px4 py1 rounded @click="handleError">
Go Back
</button>
</div>
</NuxtLayout>
</template>