From af78257418865b208bbe7ec884587f0258d8ff74 Mon Sep 17 00:00:00 2001 From: youssefshibl Date: Fri, 22 Mar 2024 00:10:27 +0200 Subject: [PATCH] refactor: :recycle: add pattern to invalid route with redirect & message error --- frontend/src/router.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/src/router.ts b/frontend/src/router.ts index f3db7a6..1f3aadb 100644 --- a/frontend/src/router.ts +++ b/frontend/src/router.ts @@ -7,6 +7,8 @@ import DashboardHome from "./pages/DashboardHome.vue"; import Console from "./pages/Console.vue"; import Compose from "./pages/Compose.vue"; import ContainerTerminal from "./pages/ContainerTerminal.vue"; +import { useToast } from "vue-toastification"; +const toast = useToast(); const Settings = () => import("./pages/Settings.vue"); @@ -92,6 +94,15 @@ const routes = [ path: "/setup", component: Setup, }, + { + path: "/:pathMatch(.*)*", + redirect: (to) => { + setTimeout(() => { + toast.error("Page not found"); + }, 100); + return "/"; + }, + } ]; export const router = createRouter({