refs #5989 bton redirect

This commit is contained in:
Carlos Satorres 2023-08-08 09:31:09 +02:00
parent ac7462ec67
commit 9a634f08a5
2 changed files with 11 additions and 29 deletions

View File

@ -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');
}
}
</script>
@ -79,21 +69,11 @@ async function redirect() {
<QSpace />
<div class="q-pl-sm q-gutter-sm row items-center no-wrap">
<div id="actions-prepend"></div>
<QBtn
@click="redirect(this.$route.params.id)"
icon="open_in_new"
label="Ir a SALIX"
></QBtn>
<QBtn @click="redirect($route.params.id)" icon="open_in_new"> </QBtn>
<QBtn id="pinnedModules" icon="apps" flat dense rounded>
<QTooltip bottom>
{{ t('globals.pinnedModules') }}
</QTooltip>
<PinnedModules>
<QBtn
@click="redirect(this.$route.params.id)"
icon="open_in_new"
></QBtn>
</PinnedModules>
</QBtn>
<QBtn rounded dense flat no-wrap id="user">
<QAvatar size="lg">

View File

@ -36,7 +36,9 @@ const pinnedModules = computed(() => navigation.getPinnedModules());
<div class="text-grey-5" v-if="pinnedModules.length === 0">
{{ t('pinnedInfo') }}
</div>
<template v-if="pinnedModules.length">
<QBtn @click="redirect($route.params.id)" icon="open_in_new">
</QBtn>
<template v-if="pinnedModules.length >= 0">
<div
v-for="item of pinnedModules"
:key="item.title"
@ -90,7 +92,7 @@ const pinnedModules = computed(() => navigation.getPinnedModules());
<i18n>
{
"en": {
"en": {
"pinnedInfo": "Your pinned modules will be shown here..."
},
"es": {