Skip to content

Commit

Permalink
feat(router): add 404 error page route for unmatched paths
Browse files Browse the repository at this point in the history
Add a NotFoundView component to handle paths that don't match
any existing route, improving user navigation experience.
  • Loading branch information
ShiinaKin committed Oct 28, 2024
1 parent 99baf2f commit dbfddfd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
13 changes: 5 additions & 8 deletions ui/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ import { createRouter, createWebHistory } from "vue-router";
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
// {
// path: '/about',
// name: 'about',
// // route level code-splitting
// // this generates a separate chunk (About.[hash].js) for this route
// // which is lazy-loaded when the route is visited.
// component: () => import('../views/AboutView.vue')
// }
{
path: "/:pathMatch(.*)",
name: "notFound",
component: () => import("@/views/error/NotFoundView.vue")
}
]
});

Expand Down
9 changes: 9 additions & 0 deletions ui/src/views/error/NotFoundView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script setup lang="ts">
</script>

<template>
<div class="grid h-screen place-content-center bg-white px-4">
<h1 class="uppercase tracking-widest text-gray-500">404 | Not Found</h1>
</div>
</template>

0 comments on commit dbfddfd

Please sign in to comment.