refs #5989 comment
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-08-04 06:18:47 +02:00
parent bf256574c9
commit ac7462ec67
1 changed files with 24 additions and 11 deletions

View File

@ -7,6 +7,7 @@ import { useState } from 'src/composables/useState';
import { useStateStore } from 'stores/useStateStore';
import PinnedModules from './PinnedModules.vue';
import { getUrl } from 'src/composables/getUrl';
import { useRoute } from 'vue-router';
const { t } = useI18n();
const session = useSession();
@ -14,21 +15,28 @@ const stateStore = useStateStore();
const state = useState();
const user = state.getUser();
const token = session.getToken();
const route = useRoute();
onMounted(() => stateStore.setMounted());
onMounted(() => stateStore. setMounted());
function redirect() {
async function redirect() {
const currentURL = window.location.href;
const routeRegex = /\/#\/(\w+)(?:\/(\d+))?/;
const routeRegex = /\/(\w+)(?:\/(\d+))?/;
const match = currentURL.match(routeRegex);
if (match) {
const [, element, number] = match;
const redirectURL =
getUrl() + (number ? `${element}/${number}/summary` : `${element}/index`);
window.location.href = redirectURL;
const [, element, number] = match;
console.log(route.path);
const section = route.path.substring(route.path.indexOf('/'));
console.log(section);
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);
} else {
window.location.href = getUrl();
console.log(await getUrl(section));
// window.location.href = await getUrl('claim');
}
}
</script>
@ -80,7 +88,12 @@ function redirect() {
<QTooltip bottom>
{{ t('globals.pinnedModules') }}
</QTooltip>
<PinnedModules />
<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">