feat: add custom 404/500 error pages

This commit is contained in:
2026-09-16 00:07:35 +02:00
parent 8b9c254fd2
commit 68de07645a
4 changed files with 70 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
<script setup lang="ts">
interface Props {
code?: string;
title?: string;
message?: string;
}
withDefaults(defineProps<Props>(), {
code: "500",
title: "Something went wrong",
message: "An unexpected error occurred.",
});
const goBack = () => window.history.back();
</script>
<template>
<div class="min-h-screen bg-base-300 flex items-center justify-center px-4">
<div class="w-full max-w-xl text-center">
<i class="mdi mdi-alert-circle-outline text-7xl text-primary"></i>
<h1 class="text-7xl font-bold mt-4">{{ code }}</h1>
<h2 class="text-2xl font-semibold mt-2">{{ title }}</h2>
<p class="text-base-content/70 mt-4">{{ message }}</p>
<div class="mt-8 flex items-center justify-center gap-4">
<a href="/" class="btn btn-primary">
<i class="mdi mdi-home mr-2"></i>
Go home
</a>
<button @click="goBack" class="btn btn-ghost">
<i class="mdi mdi-arrow-left mr-2"></i>
Go back
</button>
</div>
</div>
</div>
</template>
+8
View File
@@ -0,0 +1,8 @@
import { createApp } from 'vue'
import ErrorPage from '@/ErrorPage.vue'
import '@/style.css'
const selector = "#app"
const mountData = document.querySelector<HTMLElement>(selector)
const app = createApp(ErrorPage, { ...mountData?.dataset })
app.mount(selector)