From 9a634f08a548ed8b705e7fe6ecb8930ebdbbbc31 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 8 Aug 2023 09:31:09 +0200 Subject: [PATCH] refs #5989 bton redirect --- src/components/NavBar.vue | 34 ++++++--------------------- src/pages/Dashboard/DashboardMain.vue | 6 +++-- 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index 4c543cb1b..457cc7a7a 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -17,26 +17,16 @@ const user = state.getUser(); const token = session.getToken(); const route = useRoute(); -onMounted(() => stateStore. setMounted()); +onMounted(() => stateStore.setMounted()); async function redirect() { - const currentURL = window.location.href; - const routeRegex = /\/(\w+)(?:\/(\d+))?/; - const match = currentURL.match(routeRegex); - const [, element, number] = match; - console.log(route.path); - const section = route.path.substring(route.path.indexOf('/')); - console.log(section); + let section = route.path.substring(1); + if (!route.path.includes('/')) return (window.location.href = await getUrl(section)); + section = section.substring(0, section.indexOf('/')); if (route?.params?.id) { - // const redirectURL = - // getUrl() + (number ? `${element}/${number}/summary` : `${element}/index`); - // window.location.href = redirectURL; - console.log(await getUrl(section)); - window.location.href = await getUrl(section + route.params); + window.location.href = await getUrl(`${section}/${route.params.id}/summary`); } else { - console.log(await getUrl(section)); - - // window.location.href = await getUrl('claim'); + window.location.href = await getUrl(section + 'dashboard'); } } @@ -79,21 +69,11 @@ async function redirect() {
- + {{ t('globals.pinnedModules') }} - - - diff --git a/src/pages/Dashboard/DashboardMain.vue b/src/pages/Dashboard/DashboardMain.vue index 8db97c448..0cd869f1c 100644 --- a/src/pages/Dashboard/DashboardMain.vue +++ b/src/pages/Dashboard/DashboardMain.vue @@ -36,7 +36,9 @@ const pinnedModules = computed(() => navigation.getPinnedModules());
{{ t('pinnedInfo') }}
-