Skip to content

Commit 1302293

Browse files
committed
Add option to "Go Home" when an error happens
1 parent 05799f8 commit 1302293

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

error.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@
88
<div class="flex flex-col">
99
<p class="font-bold">{{ props.error.statusCode }}</p>
1010
<p>{{ props.error.message }}</p>
11+
<div class="mt-3">
12+
<WlButton variant="secondary" @click="listeners.home">Go Home</WlButton>
13+
</div>
1114
</div>
1215
</div>
1316
</WlContainer>
1417
</NuxtLayout>
1518
</template>
1619

1720
<script setup lang="ts">
18-
import type { NuxtError } from '#app'
21+
import { clearError, type NuxtError } from '#app'
22+
import WlButton from '~/components/experiments/forms-input/buttons/WlButton.vue'
1923
import WlTriangleExclamationIcon from '~/components/shared/icons/static/WlTriangleExclamationIcon.vue'
2024
import WlContainer from '~/components/shared/layout/WlContainer.vue'
2125
@@ -29,4 +33,13 @@ const props = defineProps<Props>()
2933
//
3034
// The instance returned here is the same as `props.error`.
3135
// const globalError = useError()
36+
37+
const listeners = {
38+
home () {
39+
clearError({
40+
redirect: '/'
41+
})
42+
}
43+
}
3244
</script>
45+

0 commit comments

Comments
 (0)