diff --git a/src/layouts/componentTest/componentTest.vue b/src/layouts/componentTest/componentTest.vue
new file mode 100644
index 000000000..493b9c1d4
--- /dev/null
+++ b/src/layouts/componentTest/componentTest.vue
@@ -0,0 +1,60 @@
+
+
+
+
+
diff --git a/src/layouts/home/home.spec.js b/src/layouts/home/home.spec.js
deleted file mode 100644
index 882a68129..000000000
--- a/src/layouts/home/home.spec.js
+++ /dev/null
@@ -1 +0,0 @@
-test.todo('some test to be written in the future');
\ No newline at end of file
diff --git a/src/layouts/home/home.vue b/src/layouts/home/home.vue
deleted file mode 100644
index fae0ff39c..000000000
--- a/src/layouts/home/home.vue
+++ /dev/null
@@ -1,6 +0,0 @@
-
- Not foundHome
-
Not Found .... :(
+ \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index c01945ed4..d46e6b14a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,22 +1,28 @@ import { createWebHistory, createRouter } from "vue-router"; import { storeActions } from "@/constants/storeActions.js"; import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js"; +import ComponentTest from "@/layouts/componentTest/componentTest.vue"; import NotFound from "@/layouts/notFound/notFound.vue"; import store from "@/store"; const routes = [ { - path: "/not-found", - name: "NotFound", + path: '/:pathMatch(.*)*', component: NotFound, + name: "NotFound" + }, + { + path: "/component-test", // This is a temporary route for testing. + name: "ComponentTest", + component: ComponentTest, }, { path: "/", beforeEnter(to, from, next) { - + // If we have no query string, or we don't have the FmgPage query string. if (Object.keys(to.query).length === 0 ||to.query.fmgPage === undefined) { - next({ name: "NotFound" }); + RetainStructureAndGoTo404(to, next); } else { // If we already have our route, go to it. @@ -43,6 +49,10 @@ const routes = [ }) .catch((error) => { + + // If we can't find the route, go to the 404 page. + RetainStructureAndGoTo404(to, next); + console.log("error:"); console.log(error); }); @@ -84,4 +94,14 @@ function GetRouteInfoFromPageName(pageName) { }); } +// Go to our 404 page but retain our structure when we go there (path, queryString, hash). +function RetainStructureAndGoTo404(to, next){ + next({ + name: 'NotFound', + params: { pathMatch: to.path.split('/').slice(1) }, + query: to.query, + hash: to.hash + }); +} + export default router;