From: Jérôme Benoit Date: Wed, 6 Mar 2024 19:04:48 +0000 (+0100) Subject: feat(ui): add 'Not found' catch all X-Git-Tag: v1.3.0~40 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=877b880ca5f6643f4aab913a3f92d027e30ccd28;p=e-mobility-charging-stations-simulator.git feat(ui): add 'Not found' catch all Signed-off-by: Jérôme Benoit --- diff --git a/ui/web/src/App.vue b/ui/web/src/App.vue index 471a240a..f8fe8b24 100644 --- a/ui/web/src/App.vue +++ b/ui/web/src/App.vue @@ -1,6 +1,9 @@ diff --git a/ui/web/src/router/index.ts b/ui/web/src/router/index.ts index bdb22503..23cca6a4 100644 --- a/ui/web/src/router/index.ts +++ b/ui/web/src/router/index.ts @@ -3,6 +3,7 @@ import ChargingStationsView from '@/views/ChargingStationsView.vue' import StartTransaction from '@/components/actions/StartTransaction.vue' import AddChargingStations from '@/components/actions/AddChargingStations.vue' import SetSupervisionUrl from '@/components/actions/SetSupervisionUrl.vue' +import NotFoundView from '@/views/NotFoundView.vue' export const router = createRouter({ history: createWebHistory(), @@ -39,6 +40,13 @@ export const router = createRouter({ action: StartTransaction }, props: { default: false, action: true } + }, + { + name: 'not-found', + path: '/:pathMatch(.*)*', + components: { + default: NotFoundView + } } ] }) diff --git a/ui/web/src/views/ChargingStationsView.vue b/ui/web/src/views/ChargingStationsView.vue index 213832c1..c250b9a6 100644 --- a/ui/web/src/views/ChargingStationsView.vue +++ b/ui/web/src/views/ChargingStationsView.vue @@ -20,7 +20,7 @@ () => { setToLocalStorage('uiServerConfigurationIndex', state.uiServerIndex) clearToggleButtons() - $router.currentRoute.value.name !== 'charging-stations' && + $route.name !== 'charging-stations' && $router.push({ name: 'charging-stations' }) }, { once: true } diff --git a/ui/web/src/views/NotFoundView.vue b/ui/web/src/views/NotFoundView.vue new file mode 100644 index 00000000..a87072aa --- /dev/null +++ b/ui/web/src/views/NotFoundView.vue @@ -0,0 +1,15 @@ + + + + +