refactor: ♻️ add pattern to invalid route with redirect & message error

This commit is contained in:
youssefshibl 2024-03-22 00:10:27 +02:00
parent 74c8baef93
commit af78257418

View file

@ -7,6 +7,8 @@ import DashboardHome from "./pages/DashboardHome.vue";
import Console from "./pages/Console.vue"; import Console from "./pages/Console.vue";
import Compose from "./pages/Compose.vue"; import Compose from "./pages/Compose.vue";
import ContainerTerminal from "./pages/ContainerTerminal.vue"; import ContainerTerminal from "./pages/ContainerTerminal.vue";
import { useToast } from "vue-toastification";
const toast = useToast();
const Settings = () => import("./pages/Settings.vue"); const Settings = () => import("./pages/Settings.vue");
@ -92,6 +94,15 @@ const routes = [
path: "/setup", path: "/setup",
component: Setup, component: Setup,
}, },
{
path: "/:pathMatch(.*)*",
redirect: (to) => {
setTimeout(() => {
toast.error("Page not found");
}, 100);
return "/";
},
}
]; ];
export const router = createRouter({ export const router = createRouter({